[
https://issues.apache.org/jira/browse/GROOVY-12162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18095967#comment-18095967
]
ASF GitHub Bot commented on GROOVY-12162:
-----------------------------------------
github-actions[bot] commented on PR #2707:
URL: https://github.com/apache/groovy/pull/2707#issuecomment-4960806938
### JMH summary — indy (commit `d2fd62f`)
Speedup vs trailing 90-day baseline on gh-pages. Higher = faster.
`1.00` = in line with history. Per-benchmark ratio, geomean within group.
Time-per-op units inverted so direction is consistent. The *calibrated*
column divides out this runner's speed vs the baseline hardware, as
measured by Groovy-independent pure-Java ruler benchmarks.
| Group | Speedup | Calibrated | n |
|--------|---------|------------|---|
| bench | 0.965 × | 0.994 × | 84 |
| core | 3.516 × | 3.304 × | 77 |
| grails | 2.600 × | 2.354 × | 80 |
> ⚠️ Runner speed differs ≥15% from the historical baseline hardware for:
grails-ad. Raw speedups are not meaningful for those parts — use the calibrated
column.
<sub>Runner calibration (this run vs baseline hardware): bench 0.97× (26
rulers) · core-ag 1.00× (3 rulers) · core-hz 1.14× (3 rulers) · grails-ad 1.40×
(3 rulers) · grails-ez 0.91× (3 rulers)</sub>
<sub>Baseline: <code>dev/bench/jmh/<part>/indy/data.js</code> on
gh-pages, trailing 90 days. <a
href="https://apache.github.io/groovy/dev/bench/jmh/summary.html">Daily
dashboard</a> · <a
href="https://apache.github.io/groovy/dev/bench/jmh/">Per-suite raw
data</a></sub>
<!
> Harden and extend bytecode peephole optimization
> ------------------------------------------------
>
> Key: GROOVY-12162
> URL: https://issues.apache.org/jira/browse/GROOVY-12162
> Project: Groovy
> Issue Type: Improvement
> Reporter: Daniel Sun
> Priority: Major
>
> h2. Overview
> Follow-up to GROOVY-12065. The initial peephole layer
> ({{{}PeepholeOptimizingMethodVisitor{}}}) only wrapped selected
> {{visitMethod}} call sites. After {{OperandStack}} started
> emitting constants via {{visitLdcInsn}} and relying on the
> peephole visitor for compaction, any method that was *not* wrapped
> regressed to non-compact forms. Class-generation error diagnostics
> that depended on {{TraceMethodVisitor}} were also broken once
> the peephole wrapper sat in front of the trace visitor.
> This improvement applies peephole compaction uniformly, restores
> diagnostics, and adds several safe local-window rewrites that
> further shrink generated bytecode without changing runtime
> semantics.
> h2. Problems Addressed
> * *Inconsistent application:* MOP bridges, call-site helpers,
> {{{}class${}}}, and other synthetic methods often bypassed the
> peephole wrapper while user methods did not.
> * *Broken classgen diagnostics:*
> {{mv instanceof TraceMethodVisitor}} no longer matched after
> wrapping, so "Last known generated bytecode" was never printed
> when {{visitMaxs}} failed under classgen logging.
> * *Incomplete dead-code patterns:*
> {{{}ALOAD{}}}/reference {{{}LDC{}}}; {{{}CHECKCAST{}}}; {{POP}}
> only dropped the cast (the load remained); bare
> {{{}DUP{}}}/{{{}DUP2{}}}; matching {{{}POP{}}}/{{{}POP2{}}} was left
> untouched; {{{}ACONST_NULL{}}}; {{IF_ACMP*}} was not rewritten
> to {{{}IFNULL{}}}/{{{}IFNONNULL{}}}.
> * *Side-effect caution:* dropping a standalone {{CHECKCAST}}
> immediately before void {{RETURN}} could discard a type-check
> side effect for a value already committed to the stack.
> h2. Changes
> h3. Uniform application
> * Introduce {{{}PeepholeOptimizingClassVisitor{}}}, installed once
> from {{{}WriterController{}}}, so every method body (including
> synthetic helpers) is routed through
> {{{}PeepholeOptimizingMethodVisitor{}}}.
> * Remove ad-hoc {{new PeepholeOptimizingMethodVisitor(...)}}
> wraps from {{AsmClassGenerator}} and {{{}CallSiteWriter{}}}.
> h3. Diagnostics
> * Add {{PeepholeOptimizingMethodVisitor.printTraceBytecode}} to
> walk the visitor chain and print a nested
> {{TraceMethodVisitor}} when present.
> h3. Additional rewrites (still single-pass / stack-local)
> * Attach {{CHECKCAST}} to a pending {{ALOAD}} or reference
> constant so load + cast + {{POP}} collapses completely when
> the value is unused; keep the cast when the value is used.
> * Rewrite {{{}ACONST_NULL{}}}; {{{}IF_ACMPEQ{}}}/{{{}IF_ACMPNE{}}} to
> {{{}IFNULL{}}}/{{{}IFNONNULL{}}}.
> * Eliminate bare {{{}DUP{}}}/{{{}DUP2{}}} followed by a matching pop
> (with or without an intervening store → store-only form).
> * On void {{{}RETURN{}}}, drop only pending variable/constant loads
> (preserving {{{}IINC{}}}); flush a standalone {{CHECKCAST}}
> instead of discarding it.
> * Buffer replacement flushes prior pending state instead of
> silently clearing it; integer constant emission reuses
> {{BytecodeHelper.pushConstant}} on the delegate.
> h2. Safety
> The visitor remains a single candidate window: pending state is
> flushed at labels, frames, line numbers, invokes, and other
> non-local boundaries. Signed zero constants continue to use raw-bit
> comparisons (GROOVY-9797).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)