-
Notifications
You must be signed in to change notification settings - Fork 120
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
performance of parser #205
Comments
Not much work has gone into performance optimizations yet. |
Ok, then I'll risk a deeper look with the profiler. |
This has been achieved by using a dictionary to quickly lookup common literals to get their corresponding tokens. Related to: opening-hours#205
I read a part of the implementation and it looked rather inefficient. To make it short, #213 contains a patch which improves common constructor calls by factor 6. I expect more such inefficiencies. Note that I started with this project without any prior JavaScript knowledge and not so much programming experience back then. Also JavaScript is not really my main programming language (currently Python I would say).
Looking forward to your pull requests 😉 |
Thanks for the efforts. Hadn't had time to check myself in a profiler yet. But lookup is always good. |
Should already be pretty early or do you see further room for improvement? |
I wonder why the parser includes this awful regex Is it really part of the spec that the opening hours string can be localized? |
re the "24/7". It's not the first one. Its inside the while loop after |
It is illogical to do this but that does not keep people from doing just that (search for 24/7) and the spec disallow this. That is why the lib gives a warning in those cases.
Mean a fallback rule? Sure, why not. This would even be allowed by the spec but it is illogical as well (which is why the lib gives a warning here as well).
No and never will be. This is part of the error tolerance. The reason it is in the core is historical. The lib cares for OSM first of all. Please refer to #143 |
@pke Just because you don’t use this lib anymore does not mean that you have to close valid issues you reported ;-) Reopening. For reference, you probably switched to https://github.com/pke/simple-opening-hours. I guess such info is always interesting for others reading this. |
I profiled my normalization function that creates about 120 opening_hour objects and it takes a whopping 3 seconds. Is there a way to speed that up? Has the parser been optimized for performance yet?
I might move the creation of those objects to a worker so that the main app thread is not blocked.
The text was updated successfully, but these errors were encountered: