Skip to content
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

isDecimal terrible performance #232

Open
jonenst opened this issue May 29, 2020 · 4 comments
Open

isDecimal terrible performance #232

jonenst opened this issue May 29, 2020 · 4 comments

Comments

@jonenst
Copy link

jonenst commented May 29, 2020

Hi,
using flamecharts to investigate the performance of getPathLength, I noticed that 80% of the time is spent in the isDecimal function. Replacing it with a faster version would improve performance by a factor of 3 or 4. See this codepen: https://codepen.io/jonenst/pen/OJyeeVN

when replacing the isDecimal function with "return true", the time to run the script goes from 6.5s to 2s: https://codepen.io/jonenst/pen/GRpbVry

@jonenst
Copy link
Author

jonenst commented May 29, 2020

Or the code could be restructured to offer unsafe versions of function that don't validate input if it's not possible to make it fast ?

@jonenst
Copy link
Author

jonenst commented May 29, 2020

Also the next bottleneck is the keys lookup for ["lat", "latitude", 1] and the same for longitude. Removing this reduces the time to 0.5s

@dahlmo
Copy link

dahlmo commented Aug 11, 2022

Codepen entries give 404 now @jonenst

@jonenst
Copy link
Author

jonenst commented Aug 11, 2022

Doh, do they expire? Sorry, didn't know about that. It wasn't very complicated though, should be easy to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants