Skip to content

Dedupe simulator paint-scope leak warnings (#5102)#5111

Merged
shai-almog merged 1 commit into
masterfrom
fix-5102-paint-scope-log-dedup
May 30, 2026
Merged

Dedupe simulator paint-scope leak warnings (#5102)#5111
shai-almog merged 1 commit into
masterfrom
fix-5102-paint-scope-log-dedup

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • The simulator paint-scope checks added for crash in IOS graphics - probably a regression #5058 fire on every offending repaint. Framework components that routinely leak harmless state (BGPainter, Toolbar, Button, TextArea, and the simulator's own ComponentTreeInspector$SelectedComponentGlassPane) caused the EDT log to flood at ~60Hz and burned CPU formatting it -- this is the spam reported in Debug trace repeating (and eating up the cpu ;-) #5102.
  • JavaSEPort.endPaintScope now builds an (owner-class, leak-kinds) signature for each leak and only logs the first occurrence per signature ("Further occurrences of this leak shape are suppressed."). Auto-restore still runs on every leak so on-device behavior is unchanged.
  • ComponentTreeInspector.SelectedComponentGlassPane.paint now save/restores color and alpha around its highlight fill, removing one real leak that was contributing to the noise.
  • New PaintScopeTest.repeatedLeakLogsOncePerSignature installs a capturing Log, repeats the same leak 5 times (expects 1 message), runs a second leak on a different owner class (expects 2 messages total), and confirms auto-restore still fires when the warning is suppressed.

Fixes #5102.

Test plan

  • mvn -pl javase test -Dtest=PaintScopeTest — 7/7 pass.
  • Run the simulator against an app that previously spammed (e.g. one with a custom BGPainter) and confirm each unique leak shape appears at most once in the log.

🤖 Generated with Claude Code

The paint-scope checks added for #5058 fire on every offending repaint,
so framework components that routinely leak harmless state (BGPainter,
Toolbar, Button, TextArea, the simulator's own SelectedComponentGlassPane)
flooded the EDT log at ~60Hz and burned CPU formatting it.

Track a (owner-class, leak-kinds) signature per warning and only emit
the first occurrence. Auto-restore still runs every time so on-device
behavior is unchanged. Also fix SelectedComponentGlassPane to actually
save/restore color and alpha around its highlight fill.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 11 screenshots: 11 matched.
✅ JavaSE simulator integration screenshots matched stored baselines.

@github-actions
Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 46 screenshots: 46 matched.
✅ JavaScript-port screenshot tests passed.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 122 screenshots: 122 matched.

Native Android coverage

  • 📊 Line coverage: 12.82% (7465/58229 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.43% (37375/358503), branch 4.32% (1463/33874), complexity 5.42% (1763/32544), method 9.46% (1443/15249), class 15.57% (331/2126)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 12.82% (7465/58229 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.43% (37375/358503), branch 4.32% (1463/33874), complexity 5.42% (1763/32544), method 9.46% (1443/15249), class 15.57% (331/2126)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 813.000 ms
Base64 CN1 encode 181.000 ms
Base64 encode ratio (CN1/native) 0.223x (77.7% faster)
Base64 native decode 822.000 ms
Base64 CN1 decode 498.000 ms
Base64 decode ratio (CN1/native) 0.606x (39.4% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 122 screenshots: 122 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 178 seconds

Build and Run Timing

Metric Duration
Simulator Boot 61000 ms
Simulator Boot (Run) 1000 ms
App Install 13000 ms
App Launch 8000 ms
Test Execution 316000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 644.000 ms
Base64 CN1 encode 1486.000 ms
Base64 encode ratio (CN1/native) 2.307x (130.7% slower)
Base64 native decode 468.000 ms
Base64 CN1 decode 1316.000 ms
Base64 decode ratio (CN1/native) 2.812x (181.2% slower)
Base64 SIMD encode 431.000 ms
Base64 encode ratio (SIMD/native) 0.669x (33.1% faster)
Base64 encode ratio (SIMD/CN1) 0.290x (71.0% faster)
Base64 SIMD decode 404.000 ms
Base64 decode ratio (SIMD/native) 0.863x (13.7% faster)
Base64 decode ratio (SIMD/CN1) 0.307x (69.3% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 57.000 ms
Image createMask (SIMD on) 9.000 ms
Image createMask ratio (SIMD on/off) 0.158x (84.2% faster)
Image applyMask (SIMD off) 124.000 ms
Image applyMask (SIMD on) 69.000 ms
Image applyMask ratio (SIMD on/off) 0.556x (44.4% faster)
Image modifyAlpha (SIMD off) 176.000 ms
Image modifyAlpha (SIMD on) 82.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.466x (53.4% faster)
Image modifyAlpha removeColor (SIMD off) 318.000 ms
Image modifyAlpha removeColor (SIMD on) 79.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.248x (75.2% faster)
Image PNG encode (SIMD off) 1350.000 ms
Image PNG encode (SIMD on) 854.000 ms
Image PNG encode ratio (SIMD on/off) 0.633x (36.7% faster)
Image JPEG encode 625.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 120 screenshots: 120 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 193 seconds

Build and Run Timing

Metric Duration
Simulator Boot 60000 ms
Simulator Boot (Run) 0 ms
App Install 11000 ms
App Launch 3000 ms
Test Execution 272000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 427.000 ms
Base64 CN1 encode 1309.000 ms
Base64 encode ratio (CN1/native) 3.066x (206.6% slower)
Base64 native decode 292.000 ms
Base64 CN1 decode 951.000 ms
Base64 decode ratio (CN1/native) 3.257x (225.7% slower)
Base64 SIMD encode 369.000 ms
Base64 encode ratio (SIMD/native) 0.864x (13.6% faster)
Base64 encode ratio (SIMD/CN1) 0.282x (71.8% faster)
Base64 SIMD decode 368.000 ms
Base64 decode ratio (SIMD/native) 1.260x (26.0% slower)
Base64 decode ratio (SIMD/CN1) 0.387x (61.3% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 57.000 ms
Image createMask (SIMD on) 9.000 ms
Image createMask ratio (SIMD on/off) 0.158x (84.2% faster)
Image applyMask (SIMD off) 116.000 ms
Image applyMask (SIMD on) 49.000 ms
Image applyMask ratio (SIMD on/off) 0.422x (57.8% faster)
Image modifyAlpha (SIMD off) 117.000 ms
Image modifyAlpha (SIMD on) 52.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.444x (55.6% faster)
Image modifyAlpha removeColor (SIMD off) 135.000 ms
Image modifyAlpha removeColor (SIMD on) 62.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.459x (54.1% faster)
Image PNG encode (SIMD off) 1076.000 ms
Image PNG encode (SIMD on) 837.000 ms
Image PNG encode ratio (SIMD on/off) 0.778x (22.2% faster)
Image JPEG encode 516.000 ms

@shai-almog shai-almog merged commit f0c4acf into master May 30, 2026
22 checks passed
@shai-almog shai-almog deleted the fix-5102-paint-scope-log-dedup branch May 30, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug trace repeating (and eating up the cpu ;-)

1 participant