Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching matched method for MethodCallExpressionNode #26

Closed
wants to merge 2 commits into from

Conversation

pawel-piecyk
Copy link

Caching matched method for method calls speed ups invocations a bit.

Measurements from jmh:

Before
Benchmark                                             Mode  Cnt        Score       Error  Units
OpelEngineBenchmark.validateComplexExpression        thrpt   16    12515.513 ±   226.341  ops/s
OpelEngineBenchmark.validateComplexParsedExpression  thrpt   16   101775.626 ±   968.739  ops/s
OpelEngineBenchmark.validateSimpleExpression         thrpt   16    53409.269 ±   934.622  ops/s
OpelEngineBenchmark.validateSimpleParsedExpression   thrpt   16  4276755.442 ± 51408.884  ops/s

After
Benchmark                                             Mode  Cnt        Score       Error  Units
OpelEngineBenchmark.validateComplexExpression        thrpt   16    12593.332 ±   282.929  ops/s
OpelEngineBenchmark.validateComplexParsedExpression  thrpt   16   356699.812 ±  5579.736  ops/s <- a few more ops/s
OpelEngineBenchmark.validateSimpleExpression         thrpt   16    53551.130 ±  1060.154  ops/s
OpelEngineBenchmark.validateSimpleParsedExpression   thrpt   16  4362191.488 ± 37889.341  ops/s

@@ -111,4 +116,28 @@ private boolean areArgsMatchForMethod(Method method, List<?> args) {
private CompletableFuture<Object> javaGenericsFix(CompletableFuture<?> it) {
return it.thenApply(Function.identity());
}

private class MethodCacheKey {
private final Class c;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class<?> ?

@pawel-piecyk
Copy link
Author

It introduces a bug, cache key should contain classes of arguments instead of instances of them. I'll close this PR and create new one when the issue will be fixed.

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