Skip to content

Conversation

@martin-g
Copy link
Member

Blog post with microbenchmarks: https://medium.com/javarevisited/micro-optimizations-in-java-string-equals-22be19fd8416
Proposal for similar change in JDK: openjdk/jdk#29

@stokito
Copy link
Contributor

stokito commented Sep 11, 2020

In fact Tomcat has hundreds of such places where simple, safe, and more readable optimizations can be applied. Just open sources in IntelliJ, open Settings/Editor/Inspections/Java/Performarmance and enable all and then run Analyze.
Most hot places are unefficient working with maps like containsKey() then get() call and collections ans StringBuilder without initial capacity.
It would be great just to fix all these problems at once and this will give a real impact on performance

@martin-g
Copy link
Member Author

It would be great just to fix all these problems at once

I prefer to make one kind of change at a time. It is easier to detect regressions and impact this way.

@martin-g martin-g merged commit 6053839 into apache:master Sep 15, 2020
@martin-g martin-g deleted the improvement/use-string-isempty branch September 15, 2020 09:21
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