-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
17, 21, 23, 24
Submitting this for John Engebretson, who would be dealing with this issue.
Class.getMethod() w/ no args is slow and commonly used. Dirty, broken, sensitivity-testing patch (attached as 8343559-jdk17.patch) makes it about 50% faster when the method is on the target class, and about 75% faster when the method is on a superclass. It likely requires more work to fit the most-specific method selection cleanly.
Real-life impact: Spring proxies and Tomcat's expression handling often lookup zero-arg methods... for example hashcode(), toString(), getProperty1(), when not otherwise treated as a bean.
Benchmark Mode Cnt Score Error Units
# Base:
GetMethodBenchmark.getHashMapToString avgt 4 363.709 ± 35.071 ns/op
GetMethodBenchmark.getObjectToString avgt 4 60.053 ± 1.188 ns/op
# Patched:
GetMethodBenchmark.getHashMapToString avgt 4 96.858 ± 4.919 ns/op
GetMethodBenchmark.getObjectToString avgt 4 36.941 ± 0.476 ns/op
Class.getMethod() w/ no args is slow and commonly used. Dirty, broken, sensitivity-testing patch (attached as 8343559-jdk17.patch) makes it about 50% faster when the method is on the target class, and about 75% faster when the method is on a superclass. It likely requires more work to fit the most-specific method selection cleanly.
Real-life impact: Spring proxies and Tomcat's expression handling often lookup zero-arg methods... for example hashcode(), toString(), getProperty1(), when not otherwise treated as a bean.
Benchmark Mode Cnt Score Error Units
# Base:
GetMethodBenchmark.getHashMapToString avgt 4 363.709 ± 35.071 ns/op
GetMethodBenchmark.getObjectToString avgt 4 60.053 ± 1.188 ns/op
# Patched:
GetMethodBenchmark.getHashMapToString avgt 4 96.858 ± 4.919 ns/op
GetMethodBenchmark.getObjectToString avgt 4 36.941 ± 0.476 ns/op
- links to
-
Review(master) openjdk/jdk/21929