RFR: 8246338: Reduce overhead of normalizing file paths
Claes Redestad
claes.redestad at oracle.com
Tue Jun 2 13:56:58 UTC 2020
Hi,
this patch simplifies and improves performance of
UnixFileSystem.normalize and prefixLength, which are used when opening
files. The Windows implementation is left untouched, since it's a bit
more complicated.
Bug: https://bugs.openjdk.java.net/browse/JDK-8246338
Webrev: http://cr.openjdk.java.net/~redestad/8246338/open.00/
On the provided microbenchmark, we see a small (5-10%) speed-up
in peak performance, while the speed-up is quite large when
interpreting, especially in the case where the file path is already
normalized (2.1x)[1]. Since this is the normal case, the patch has a
small but measurable effect on some startup tests.
Testing: tier1-2
Thanks!
/Claes
[1]
Before:
Benchmark Mode Cnt Score Error Units
FileOpen.mix avgt 10 0.246 ± 0.005 us/op
FileOpen.normalized avgt 10 0.022 ± 0.001 us/op
FileOpen.notNormalized avgt 10 0.080 ± 0.002 us/op
FileOpen.trailingSlash avgt 10 0.084 ± 0.003 us/op
After:
Benchmark Mode Cnt Score Error Units
FileOpen.mix avgt 10 0.237 ± 0.004 us/op
FileOpen.normalized avgt 10 0.019 ± 0.001 us/op
FileOpen.notNormalized avgt 10 0.077 ± 0.002 us/op
FileOpen.trailingSlash avgt 10 0.078 ± 0.002 us/op
Before - -Xint:
Benchmark Mode Cnt Score Error Units
FileOpen.mix avgt 10 33.573 ± 0.348 us/op
FileOpen.normalized avgt 10 6.219 ± 0.074 us/op
FileOpen.notNormalized avgt 10 12.973 ± 0.084 us/op
FileOpen.trailingSlash avgt 10 13.018 ± 0.066 us/op
After - -Xint:
Benchmark Mode Cnt Score Error Units
FileOpen.mix avgt 10 27.084 ± 0.554 us/op
FileOpen.normalized avgt 10 2.954 ± 0.005 us/op
FileOpen.notNormalized avgt 10 10.225 ± 0.061 us/op
FileOpen.trailingSlash avgt 10 10.211 ± 0.075 us/op
More information about the core-libs-dev
mailing list