New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Performance improvements in loops #111
Comments
Hi, I am open to suggestions/PR. The actual performance are pretty good for its category. In my opinion, list comprehensions lower the readability when used everywhere. 30 to 40 % of the time is consumed in the I am convinced that with a substantial effort we could make it up to two time faster while keeping accuracy. |
Hi @Ousret, I totally get your point. I first started to refactor the code in #113, feel free to amend the PR. A clear problem in |
I do not think so. I tried many alternative that failed to bring substantial improvement.
I could be wrong but that would not matter. Python len() is pretty optimized. |
* reviewed encoding language associations: caches and sets defined * use list comprehension for language association (#111) * use list comprehension and filter in char analysis (#111) * refactored variable inits in md.py * models: move regex compilation to constants * detection of Japanese characters: simplify syntax * amend detected_ranges semantics Co-authored-by: Aarni Koskela <akx@iki.fi> Co-authored-by: Ahmed TAHRI <ahmed.tahri@cloudnursery.dev>
Is your feature request related to a problem? Please describe.
Hi, I was wondering if it could be possible to improve the performance of certain loops. For example, you do use list comprehensions but not everywhere. Since you have a speed benchmark you'd see if it works in the comparison with chardet.
Describe the solution you'd like
Here are loops where things could be improved:
Additional context
I could help work on a PR if you're interested.
The text was updated successfully, but these errors were encountered: