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

performance: ReferenceBinding.superInterfaces() with redundant super interfaces #3601

Open
jukzi opened this issue Jan 23, 2025 · 1 comment · May be fixed by #3710
Open

performance: ReferenceBinding.superInterfaces() with redundant super interfaces #3601

jukzi opened this issue Jan 23, 2025 · 1 comment · May be fixed by #3710

Comments

@jukzi
Copy link
Contributor

jukzi commented Jan 23, 2025

for example
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.superInterfaces() recursively calls ReferenceBinding.superInterfaces() (without even using the returned type (// make super-type resolving recursive for propagating typeBits downwards) and does not protect against redundant super interfaces
sampling data from #3387 (comment):
Image
@fedejeanne you may want to protect this against already visited types too.

fedejeanne added a commit to fedejeanne/eclipse.jdt.core that referenced this issue Jan 27, 2025
…t#3601

- Make the method final
- Add new recursive method ReferenceBinding.superInterfacesRecursive
that takes an IndentityHashMap to keep the visited types

Fixes eclipse-jdt#3601
@fedejeanne
Copy link
Contributor

I've been looking at it and trying different approaches but I can't get any perceivable improvement in the compilation time. The problem is that the recursive call of org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.superInterfaces () only constitutes a small portion of the overall calls. A big chunk of the calls come from other methods and these are the ones which should remember which types have already been visited.

Here's an example: org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getExactMethod () (overloaded method)

Image

If one would start remembering the visited types when starting that chain of calls, one could possibly spare some calls. But that would mean passing lots of Sets around and would taint the code a lot.

Do you see any other possible approach, @jukzi ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants