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

check if list index is numeric before parsing to int #538

Merged
merged 2 commits into from
Nov 23, 2020
Merged

Conversation

boulter
Copy link
Contributor

@boulter boulter commented Nov 20, 2020

Integer.parseInt is rather expensive. For lists, CompositeElResolver first checks if the attribute is numeric which makes calling methods on lists like append() slow. We can speed that up by ensuring that the attribute is numeric before we try to parse it into an int.

For 100,000 iterations, append() took 11.4 seconds with the change and 14.6 seconds without for a speedup of 22%. 100,000 iterations of numeric attribute accesses showed no significant slowdown.

@boulter boulter merged commit f326eef into master Nov 23, 2020
@boulter boulter deleted the check-numeric branch November 23, 2020 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants