Bug 526518 - [9] Performance drop in ASTParser.createBindings
Summary: [9] Performance drop in ASTParser.createBindings
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7.1a   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-26 10:44 EDT by Christian Dietrich CLA
Modified: 2022-09-03 15:21 EDT (History)
3 users (show)

See Also:


Attachments
Example Project that reproduces the problem (1.26 MB, application/zip)
2017-10-26 10:56 EDT, Christian Dietrich CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Dietrich CLA 2017-10-26 10:44:45 EDT
we use org.eclipse.jdt.core.dom.ASTParser.createBindings(IJavaElement[], IProgressMonitor) inside Xtext to retrieve bindings for ITypes.

When running code with Xtext 2.13 with Oxygen 1a and a Java 9 Plugin Project Zoo we see a performance drop compared to Java 8 / Pre Oxygen 1a even with the patch / cache for #526209 applied.

you can find a yourkit snapshot here: https://drive.google.com/open?id=0B7rqwXB52fUOM1prTkRpWFJQV00
Comment 1 Christian Dietrich CLA 2017-10-26 10:56:00 EDT
Created attachment 271198 [details]
Example Project that reproduces the problem
Comment 2 Stephan Herrmann CLA 2017-10-26 13:37:29 EDT
(In reply to Christian Dietrich from comment #1)
> Created attachment 271198 [details]
> Example Project that reproduces the problem

Thanks, I can reproduce long build time using that example.
Comment 3 Stephan Herrmann CLA 2017-10-26 14:13:29 EDT
If memory serves me right, then according to YourKit a hotspot is in org.eclipse.jdt.internal.core.SearchableEnvironment.getModulesDeclaringPackage(char[][], char[], char[]) where it calls isPackage() right?

First observation in this area: for each invocation of ASTParser.createBindings() there are some tens of invocations where some toplevel packages are searched in all modules on the path. Non-toplevel packages trigger getModulesDeclaringPackage fewer times, but here we invoke NameLookup.isPackage() for each known package fragment root. This happens because we are looking from an unnamed module and hence don't have a module that could restrict the search scope.

I still need to investigate more, but I haven't yet found any redundant lookup and the above could well indicate that all/most of this is intrinsic new complexity in Java 9: we need to check for each referenced package whether it is uniquely visible, ergo stopping at the first hit is not an option.
If this theory can be confirmed, than we should put our money on bug 526520, rather than tweaking the implementation around SearchableEnvironment & NameLookup.
Comment 4 Stephan Herrmann CLA 2018-05-08 16:41:07 EDT
Should decide early in 4.9 if we invest here, or put our money on bug 526520.
Comment 5 Eclipse Genie CLA 2022-09-03 15:21:15 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.