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

Performance optimization #352

Merged
merged 6 commits into from
Jul 19, 2024
Merged

Performance optimization #352

merged 6 commits into from
Jul 19, 2024

Conversation

asolntsev
Copy link
Contributor

No description provided.

My profiler shows that some remarkable % of CPU is spent on generating this string: (" " + c + " "). Now we check for CSS class without generating the new string. The code is longer, but faster.
Now we check the "lang" attribute without calling `String.split` method which generates new strings.
in some places, I replaced them with `synchronizedMap()` or `ConcurrentHashMap`.
Not 100% sure nothing gets broken. :)
But at least all tests are still green.
I don't know what was the initial idea, and was it intended to pass any other parameters, but currently only `org.w3c.dom.Node` is passed there.
My profiler shows that `nsh.getClass((Element) e)` consumes quite a remarkable percentage of total CPU time.
So I hope caching these value could improve performance (though, my profiler doesn't show it :) ).
@asolntsev asolntsev added this to the 9.9.0 milestone Jul 19, 2024
@asolntsev asolntsev linked an issue Jul 19, 2024 that may be closed by this pull request
@asolntsev asolntsev self-assigned this Jul 19, 2024
@asolntsev asolntsev merged commit 2c4f0bd into main Jul 19, 2024
2 checks passed
@asolntsev asolntsev deleted the performance/340-optimization branch July 19, 2024 19:05
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.

How to improve tps in multithreading
1 participant