Skip to content

ReflectivePropertyAccessor should cache sorted methods [SPR-16882] #21421

Closed
@spring-projects-issues

Description

@spring-projects-issues

Pavel Khokhlov opened SPR-16882 and commented

After migration from SPEL 4.3.9.RELEASE -> 4.3.10.RELEASE we noticed performance degradation with SPEL Expression (at least 2.5x times).

In attachment you can find [^benchmark.zip]

You can see JMH report (I used jdk1.8.0_151)

This is 4.3.10.RELEASE

/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -classpath /Users/pkhokhlov/JProjects/benchmark/target/test-classes:/Users/pkhokhlov/.m2/repository/org/openjdk/jmh/jmh-core/1.21/jmh-core-1.21.jar:/Users/pkhokhlov/.m2/repository/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar:/Users/pkhokhlov/.m2/repository/org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar:/Users/pkhokhlov/.m2/repository/org/openjdk/jmh/jmh-generator-annprocess/1.21/jmh-generator-annprocess-1.21.jar:/Users/pkhokhlov/.m2/repository/org/springframework/spring-expression/4.3.10.RELEASE/spring-expression-4.3.10.RELEASE.jar:/Users/pkhokhlov/.m2/repository/org/springframework/spring-core/4.3.10.RELEASE/spring-core-4.3.10.RELEASE.jar:/Users/pkhokhlov/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar org.openjdk.jmh.Main org.spel.bug.SpelBenchmark.*
1. JMH version: 1.21
1. VM version: JDK 1.8.0_151, Java HotSpot(TM) 64-Bit Server VM, 25.151-b12
1. VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/bin/java
1. VM options: -Dfile.encoding=UTF-8
1. Warmup: 2 iterations, 10 s each
1. Measurement: 2 iterations, 10 s each
1. Timeout: 10 min per iteration
1. Threads: 1 thread, will synchronize iterations
1. Benchmark mode: Throughput, ops/time
1. Benchmark: org.spel.bug.SpelBenchmark.spel# Run progress: 0.00% complete, ETA 00:00:40
1. Fork: 1 of 1
1. Warmup Iteration   1: 197599.695 ops/s
1. Warmup Iteration   2: 225828.094 ops/s
Iteration   1: 225044.963 ops/s
Iteration   2: 228451.901 ops/s
Result "org.spel.bug.SpelBenchmark.spel":
  226748.432 ops/s
1. Run complete. Total time: 00:00:40REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
experiments, perform baseline and negative tests that provide experimental control, make sure
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
Do not assume the numbers tell you what you want them to tell.Benchmark            Mode  Cnt       Score   Error  Units
SpelBenchmark.spel  thrpt    2  226748.432          ops/s

This is 4.3.9.RELEASE

/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -classpath /Users/pkhokhlov/JProjects/benchmark/target/test-classes:/Users/pkhokhlov/.m2/repository/org/openjdk/jmh/jmh-core/1.21/jmh-core-1.21.jar:/Users/pkhokhlov/.m2/repository/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar:/Users/pkhokhlov/.m2/repository/org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar:/Users/pkhokhlov/.m2/repository/org/openjdk/jmh/jmh-generator-annprocess/1.21/jmh-generator-annprocess-1.21.jar:/Users/pkhokhlov/.m2/repository/org/springframework/spring-expression/4.3.9.RELEASE/spring-expression-4.3.9.RELEASE.jar:/Users/pkhokhlov/.m2/repository/org/springframework/spring-core/4.3.9.RELEASE/spring-core-4.3.9.RELEASE.jar:/Users/pkhokhlov/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar org.openjdk.jmh.Main org.spel.bug.SpelBenchmark.*
1. JMH version: 1.21
1. VM version: JDK 1.8.0_151, Java HotSpot(TM) 64-Bit Server VM, 25.151-b12
1. VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/bin/java
1. VM options: -Dfile.encoding=UTF-8
1. Warmup: 2 iterations, 10 s each
1. Measurement: 2 iterations, 10 s each
1. Timeout: 10 min per iteration
1. Threads: 1 thread, will synchronize iterations
1. Benchmark mode: Throughput, ops/time
1. Benchmark: org.spel.bug.SpelBenchmark.spel# Run progress: 0.00% complete, ETA 00:00:40
1. Fork: 1 of 1
1. Warmup Iteration   1: 511243.723 ops/s
1. Warmup Iteration   2: 564409.791 ops/s
Iteration   1: 579457.251 ops/s
Iteration   2: 582177.903 ops/s
Result "org.spel.bug.SpelBenchmark.spel":
  580817.577 ops/s
1. Run complete. Total time: 00:00:40REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
experiments, perform baseline and negative tests that provide experimental control, make sure
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
Do not assume the numbers tell you what you want them to tell.Benchmark            Mode  Cnt       Score   Error  Units
SpelBenchmark.spel  thrpt    2  580817.577          ops/s

 


Affects: 4.3.10

Attachments:

Issue Links:

Referenced from: commits 4a6e9a5, bfcc1a1, da049f4, e2ccd55

Backported to: 4.3.18

0 votes, 5 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancementtype: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions