japplis opened a new pull request, #547:
URL: https://github.com/apache/commons-vfs/pull/547

   Here is a performance improvement of `UriParser.normalise()`.
   I've replaced the slow `StringBuilder.substring()` with 
`StringBuilder.charAt()`. I think that `StringBuilder.subSequence()` with 
`CharSequence.compare()` could show similar performance improvements. Let me 
know if you want me to test this way.
   
   Note that I would advise to first merge 
https://github.com/apache/commons-vfs/pull/543/files that fixes a bug in the 
test of %2f. I didn't want to reintroduce the bug with this merge request so 
the bug is also fixed in here. This MR may have a merge conflict with 
https://github.com/apache/commons-vfs/pull/543/ as it touches the same part of 
the code. If you want I can resolve it once 
https://github.com/apache/commons-vfs/pull/543/ is merged.
   
   On my machine (Desktop from 2016) I have a 3x throughput.
   
   JMH
   Benchmark                      Mode  Cnt       Score       Error  Units
   UriParserBenchmark.normalise  thrpt   50  994208,463  11590,176  ops/s
   
   After refactoring
   Benchmark                      Mode  Cnt        Score       Error  Units
   UriParserBenchmark.normalise  thrpt   25  2940553,554  47617,743  ops/s
   
   JFR/JMC flamegraphs
   
![profiling-UriParser-crop](https://github.com/apache/commons-vfs/assets/318821/aca64859-e509-4280-859f-92a8e6b32fde)
   
   
![profiling-UriParser2-crop](https://github.com/apache/commons-vfs/assets/318821/79cd4ccc-c7a2-4aca-8df9-50a067dfcd59)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to