Repository navigation
[java] Improve symboltable performance - #117
Conversation
- Notice the `couldResolve` doesn't guarantee a positive resolution, but still
manages to kill early some resolver checks
- `PrimiiveTypeResolver.resolve()` and `VoidTypeResolver.resolve()`
were the 2nd and 5th most time consuming methods on several profiles
I ran. This change fixes it.
- Make use of our Java knowledge when analyzing Java code
- Expand hashCode calculation for `MethodNameDeclaration` to avoid collisions
when overloading.
- Also make sure `builtInMethodDeclaration` provides a complete syntax tree to avoid NPE
when calling `hashCode` or `equals`
|
Just added an extra commit to this changeset. Though it's standalone, it's closely related. The change is two-fold:
This reduces the time needed to analyze the PMD sourceset a further 10% on top of the original 20%. I provide a sample run for reference on my machine (I run it inside a Baseline (clean from master):
This changeset:
|
- We can tell if a name can be resolved or not, and we can do so in
constant time.
|
Just realized I could rework |
- Classes in java.lang.* aren't that many, yet they hit a lot (String,
all boxed primitives, Math, etc.), so it makes sense to cache them
|
I figured out I could actually fully implement This PR now makes symboltable resolution 322% faster than before. I'll stop touching this PR while it's still readable / small enough for a proper review. Hopefully during the weekend all this will be merged / I'll get feedback and it will be much easier to keep on pushing performance. |
- Typos, extra whitespace, a missing static, clearer loops..
These changes alone have improved symboltable times reported using
-bflag when analyzing the whole PMD sourcecode in ~20%.Changes were confirmed with jvisualvm profiler too.