You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/08/22 17:43:00 UTC
[jira] [Commented] (GROOVY-12288) Cache ClassWriter getCommonSuperClass lookups per class
[ https://issues.apache.org/jira/browse/GROOVY-12288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106962#comment-18106962 ]
ASF GitHub Bot commented on GROOVY-12288:
-----------------------------------------
codecov-commenter commented on PR #2825:
URL: https://github.com/apache/groovy/pull/2825#issuecomment-5381739573
## [Codecov](https://app.codecov.io/gh/apache/groovy/pull/2825?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `81.81818%` with `8 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 70.2709%. Comparing base ([`01f91d4`](https://app.codecov.io/gh/apache/groovy/commit/01f91d475918156df6c290460c70e3c7dfbe1e36?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b57fdd5`](https://app.codecov.io/gh/apache/groovy/commit/b57fdd51c8e104565f5c4cda273ac34841be8234?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2825?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...a/org/codehaus/groovy/control/CompilationUnit.java](https://app.codecov.io/gh/apache/groovy/pull/2825?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FCompilationUnit.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvQ29tcGlsYXRpb25Vbml0LmphdmE=) | 81.8182% | [2 Missing and 6 partials :warning: ](https://app.codecov.io/gh/apache/groovy/pull/2825?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2825?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2825 +/- ##
==================================================
+ Coverage 70.2594% 70.2709% +0.0115%
- Complexity 36274 36279 +5
==================================================
Files 1569 1569
Lines 133723 133751 +28
Branches 24637 24645 +8
==================================================
+ Hits 93953 93988 +35
+ Misses 31257 31251 -6
+ Partials 8513 8512 -1
```
| [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2825?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...a/org/codehaus/groovy/control/CompilationUnit.java](https://app.codecov.io/gh/apache/groovy/pull/2825?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FCompilationUnit.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvQ29tcGlsYXRpb25Vbml0LmphdmE=) | `80.8219% <81.8182%> (+0.0766%)` | :arrow_up: |
... and [5 files with indirect coverage changes](https://app.codecov.io/gh/apache/groovy/pull/2825/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> Cache ClassWriter getCommonSuperClass lookups per class
> -------------------------------------------------------
>
> Key: GROOVY-12288
> URL: https://issues.apache.org/jira/browse/GROOVY-12288
> Project: Groovy
> Issue Type: Improvement
> Reporter: Daniel Sun
> Priority: Major
>
> Bytecode generation uses an ASM {{ClassWriter}} with {{{}COMPUTE_FRAMES{}}}. Frame computation calls {{getCommonSuperClass}} at every control-flow merge. Groovy overrides that method so types still being compiled are resolved through {{ClassNode}} ({{{}CompileUnit{}}}, generated inner classes, {{{}ClassNodeResolver{}}}) rather than {{{}Class.forName{}}}.
> {{COMPUTE_FRAMES}} asks for the same binary-name pairs many times inside one class. Each call converts slashes to dots, resolves two \{{ClassNode}}s, and walks superclasses with isDerivedFrom. Class generation is about half of compile wall time.
> h3. Approach
> Memoize both steps on the {{ClassWriter}} created by {{{}CompilationUnit.createClassVisitor{}}}. One writer is allocated per generated class and discarded afterwards, so the maps cannot go stale across classes.
> ||Cache||Key||Value||
> |{{classNodeByName}}|binary name (dot form)|{{ClassNode}} (successful lookups only)|
> |{{commonSuperByPair}}|canonical pair of internal names|internal name of the common superclass|
> The key is order-independent: {{(A,B)}} and {{(B,A)}} share one entry. The common-superclass algorithm is unchanged.
> h3. Impact
> Compile-time only. {{getCommonSuperClass}} results and generated bytecode stay the same.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)