Performance degradation with lombok#4713
Conversation
|
Could you please provide a regression test? |
Can I start tests with the |
Should be possible to start JVM from the test with extra arguments, the tests itself don't have individual configurations AFAIK. |
|
@iloveeclipse |
@iloveeclipse I have added ASTConverter18Test.testIssue4712() |
|
This pull request changes some projects for the first time in this development cycle. An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patchFurther information are available in Common Build Issues - Missing version increments. |
|
I've just rebased on master |
There was a problem hiding this comment.
Pull request overview
Addresses Eclipse JDT issue #4712 (“Performance degradation with lombok”) by avoiding expensive comment-mapping/scanning work when the AST contains synthetic/generated nodes with invalid/empty source ranges, and by tightening comment-mapper initialization.
Changes:
- Skip visiting/comment-mapping for generated AST nodes (and generated siblings) in
DefaultCommentMapper. - Avoid initializing
DefaultCommentMapperwhen the compilation unit has no comments. - Add a regression test covering the reported scenario and harden the scanner against negative positions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java |
Skips generated nodes/siblings during comment mapping to prevent pathological scanning behavior. |
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java |
Only initializes the comment mapper when there are actual comments to map. |
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java |
Adds a regression test for issue #4712 (currently includes a time-based assertion). |
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java |
Guards scanning against negative currentPosition after an IndexOutOfBoundsException. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // The convertCompilationUnit method would need to take less than one second to complete. | ||
| assertTrue((System.currentTimeMillis() - start) < 1000); |
There was a problem hiding this comment.
This test asserts a hard 1s wall-clock limit for AST.convertCompilationUnit(), which is likely to be flaky on slower/loaded CI agents and can cause unrelated failures. Consider replacing the time-based assertion with a deterministic functional assertion (e.g., verify comment mapping behavior for generated nodes) or moving this into the existing performance test infrastructure / using a much more resilient threshold with clear skip/assumption rules for slow environments.
There was a problem hiding this comment.
AST.convertCompilationUnit() takes less than 20 ms.
Fixes #4712