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

Improved performance of UriParser#extractScheme #614

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

japplis
Copy link
Contributor

@japplis japplis commented Oct 5, 2024

UriParser#extractScheme is often called, so performance of this method matters.

Here is a performance improvement that avoids many String concatenation.

Here are the JMH results
Before
Benchmark Mode Cnt Score Error Units
UriParserBenchmark.extractScheme thrpt 25 86408837,361 ▒ 3001538,949 ops/s

After
Benchmark Mode Cnt Score Error Units
UriParserBenchmark.extractScheme thrpt 25 159851495,299 ▒ 2540759,982 ops/s

JMH results show a 85% performance improvement of the method

Also attached a flame graph of FileObject#getChildren() using JFR/JMC showing that most of the time is spent in the extractScheme method
profiling-UriParser-extract-scheme
profiling-UriParser-extract-scheme-crop

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.

1 participant