Skip to content

Backend: Server-Sent Events for handlers - #6218

Merged
shai-almog merged 4 commits into
masterfrom
backend-sse
Nov 12, 2026
Merged

shai-almog merged 4 commits into
masterfrom
backend-sse

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Handlers can now answer with an event stream, for LLM-proxy and live-feed endpoints where a WebSocket is more than the job needs:

return Sse.stream(request, events -> {
    for (String token : model.tokens(prompt)) events.data(token);   // on the wire now
    events.event("done").data("{}");
});

What it is

  • Sse (vm/backend/src/com/codename1/backend/Sse.java) builds on the existing Response.stream, which already does chunked HTTP/1.1, close-delimited HTTP/1.0 and flow-controlled HTTP/2. It adds the event-stream framing:
    • data, json, event, id, retry, comment and ping(), each flushed as soon as it is written.
    • lastEventId(), so a reconnecting client resumes where it left off.
    • Cache-Control: no-cache and X-Accel-Buffering: no, so nginx does not hold events back.
    • Multi-line data is split on CR, LF and CRLF. A line break in event or id, or a NUL in id, is refused, so a value cannot forge an extra field.
  • It uses the blocking-producer model: the producer runs on the request's worker until it returns. A cross-thread SseEmitter is out of scope, because the hand-off would need Object.wait on a virtual thread, which blocks the host.

Fixes found on the way

  • Compression: with compression on, a zero minimum and a matching type, a streamed response could be sent with Content-Encoding: gzip over identity bytes. Streamed responses are never compressed now.
  • HttpProxy: it relayed an upstream event stream only when its 16 KB buffer filled, so a proxied token feed reached the client minutes late. It now flushes after every read for text/event-stream and for bodies of undeclared length. Downloads with a declared length keep sending full 16 KB chunks.

Tests

SseTest covers:

  • the framing and the refused field values.
  • real sockets, direct and through HttpProxy: the producer does not write its second event until the client has read the first, so any buffering times the test out.
  • Last-Event-ID passed through the proxy.
  • the compression guard.

Docs

A "Server-Sent Events" subsection in Backend-Web.asciidoc, with a live-feed demo in Streaming.java.

🤖 Generated with Claude Code

shai-almog and others added 3 commits November 11, 2026 20:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ared lengths

available() is always 0 on both Web impls, so the previous guard flushed
every read of every download.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@github-actions

github-actions Bot commented Nov 11, 2026 •

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)
    • ✅ android-compat: 0 findings (no issues)
    • ✅ android-res-compiler: 0 findings (no issues)
    • ✅ backend: 0 findings (no issues)
    • ✅ backend-test: 0 findings (no issues)
    • ✅ build-engine: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-gradle-plugin: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ compose-compat: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ desktop-compat-runtime: 0 findings (no issues)
    • ✅ fxml-compiler: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
    • ✅ javac: 0 findings (no issues)
    • ✅ javafx-compat: 0 findings (no issues)
    • ✅ project-model: 0 findings (no issues)
    • ✅ python-runtime: 0 findings (no issues)
    • ✅ python-transpiler: 0 findings (no issues)
    • ✅ swing-compat: 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

shai-almog commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 210 screenshots: 210 matched.
Native Windows port (x64 / Intel-AMD): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, SSE2 SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 56ms / native 4ms = 14.0x speedup
SIMD float-mul (64K x300) java 56ms / native 4ms = 14.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 77.000 ms
Base64 CN1 decode 104.000 ms
Base64 SIMD encode 109.000 ms
Base64 encode ratio (SIMD/CN1) 1.416x (41.6% slower)
Base64 SIMD decode 105.000 ms
Base64 decode ratio (SIMD/CN1) 1.010x (1.0% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 11.000 ms
Image createMask (SIMD on) 5.000 ms
Image createMask ratio (SIMD on/off) 0.455x (54.5% faster)
Image applyMask (SIMD off) 23.000 ms
Image applyMask (SIMD on) 23.000 ms
Image applyMask ratio (SIMD on/off) 1.000x (0.0% slower)
Image modifyAlpha (SIMD off) 30.000 ms
Image modifyAlpha (SIMD on) 16.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.533x (46.7% faster)
Image modifyAlpha removeColor (SIMD off) 36.000 ms
Image modifyAlpha removeColor (SIMD on) 23.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.639x (36.1% faster)

ParparVM vs HotSpot (JDK 25): Windows x64

Runner CPU: AMD64 Family 25 Model 1 Stepping 1, AuthenticAMD (baseline windows-x64@amd64-family-25-model-1-authenticamd)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.72x (base 1.22x, +40.8%) 0.72x (base 0.58x, +23.9%) ok
translator (self) 4 0.76x (base 0.83x, -9.0%) 0.57x (base 0.54x, +4.7%) ok
intArithmetic 4 1.10x (base 1.10x, +0.0%) 0.06x (base 0.06x, +3.1%) ok
longArithmetic 4 1.14x (base 1.08x, +5.0%) 0.06x (base 0.05x, +3.5%) ok
mathTranscendental 4 0.78x (base 0.79x, -0.7%) 0.06x (base 0.06x, +3.4%) ok
arraySequential 4 1.47x (base 1.36x, +7.7%) 0.39x (base 0.39x, +0.1%) ok
arrayRandom 4 1.01x (base 1.06x, -5.0%) 0.23x (base 0.23x, +0.7%) ok
objectAllocation 4 1.57x (base 1.56x, +0.9%) 0.32x (base 0.39x, -17.4%) ok
valueEscape 4 0.10x (base 0.10x, +0.4%) 0.05x (base 0.04x, +4.8%) ok
hashMapChurn 4 1.81x (base 1.80x, +0.7%) 0.10x (base 0.09x, +6.0%) ok
stringBuilding 4 1.25x (base 1.22x, +2.6%) 0.27x (base 0.32x, -17.0%) ok
recursion 4 1.41x (base 1.49x, -5.8%) 0.06x (base 0.06x, +2.0%) ok
quicksort 4 1.11x (base 1.13x, -1.9%) 0.12x (base 0.12x, +1.1%) ok

Result: no regression

@shai-almog

shai-almog commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 210 screenshots: 210 matched.
Native Windows port (arm64 / Apple Silicon - Arm): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, NEON SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 54ms / native 3ms = 18.0x speedup
SIMD float-mul (64K x300) java 54ms / native 3ms = 18.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 61.000 ms
Base64 CN1 decode 69.000 ms
Base64 SIMD encode 75.000 ms
Base64 encode ratio (SIMD/CN1) 1.230x (23.0% slower)
Base64 SIMD decode 68.000 ms
Base64 decode ratio (SIMD/CN1) 0.986x (1.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 6.000 ms
Image createMask (SIMD on) 1.000 ms
Image createMask ratio (SIMD on/off) 0.167x (83.3% faster)
Image applyMask (SIMD off) 16.000 ms
Image applyMask (SIMD on) 15.000 ms
Image applyMask ratio (SIMD on/off) 0.938x (6.3% faster)
Image modifyAlpha (SIMD off) 15.000 ms
Image modifyAlpha (SIMD on) 10.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.667x (33.3% faster)
Image modifyAlpha removeColor (SIMD off) 21.000 ms
Image modifyAlpha removeColor (SIMD on) 10.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.476x (52.4% faster)

ParparVM vs HotSpot (JDK 25): Windows arm64

Runner CPU: ARMv8 (64-bit) Family 8 Model D49 Revision 0, MICROSOFT CORPORATION (baseline windows-arm64@armv8-64-bit-family-8-model-d49-microsoft-corporation)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.51x (base 1.45x, +4.1%) 0.76x (base 0.75x, +1.3%) ok
translator (self) 4 0.91x (base 0.84x, +8.1%) 0.52x (base 0.51x, +1.9%) ok
intArithmetic 4 1.04x (base 1.04x, -0.0%) 0.06x (base 0.06x, +3.2%) ok
longArithmetic 4 0.80x (base 0.80x, +0.0%) 0.06x (base 0.06x, +3.6%) ok
mathTranscendental 4 0.73x (base 0.72x, +1.7%) 0.07x (base 0.06x, +2.0%) ok
arraySequential 4 0.39x (base 0.46x, -13.7%) 0.39x (base 0.39x, -0.1%) ok
arrayRandom 4 0.94x (base 0.94x, +0.1%) 0.23x (base 0.23x, +0.3%) ok
objectAllocation 4 1.77x (base 1.82x, -2.7%) 0.41x (base 0.43x, -4.4%) ok
valueEscape 4 0.76x (base 0.76x, +0.1%) 0.05x (base 0.05x, +3.8%) ok
hashMapChurn 4 1.00x (base 0.98x, +1.3%) 0.12x (base 0.12x, -2.8%) ok
stringBuilding 4 1.54x (base 1.43x, +7.9%) 0.27x (base 0.27x, -0.0%) ok
recursion 4 1.42x (base 1.46x, -2.9%) 0.07x (base 0.07x, +1.4%) ok
quicksort 4 1.01x (base 1.00x, +0.7%) 0.12x (base 0.12x, +0.6%) ok

Result: no regression

@shai-almog

shai-almog commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

@shai-almog

shai-almog commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 195 screenshots: 195 matched.

Native Android coverage

  • 📊 Line coverage: 19.18% (56176/292885 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 18.14% (270640/1492353), branch 12.38% (19684/158943), complexity 10.36% (15851/153017), method 15.74% (11411/72518), class 27.93% (2247/8045)
    • Lowest covered classes
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2396 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • androidx.compose.runtime.androidx.compose.runtime.LinkComposer – 0.00% (0/1430 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlinx.coroutines.channels.kotlinx.coroutines.channels.BufferedChannel – 0.00% (0/863 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/744 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/630 lines covered)
      • com.codename1.androidcompat.rt.com.codename1.androidcompat.rt.TextXmlPullParser – 0.00% (0/623 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 19.18% (56176/292885 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 18.14% (270640/1492353), branch 12.38% (19684/158943), complexity 10.36% (15851/153017), method 15.74% (11411/72518), class 27.93% (2247/8045)
    • Lowest covered classes
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2396 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • androidx.compose.runtime.androidx.compose.runtime.LinkComposer – 0.00% (0/1430 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlinx.coroutines.channels.kotlinx.coroutines.channels.BufferedChannel – 0.00% (0/863 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/744 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/630 lines covered)
      • com.codename1.androidcompat.rt.com.codename1.androidcompat.rt.TextXmlPullParser – 0.00% (0/623 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend scalar fallback (no native SIMD)
SIMD int-add (64K x300) java 109ms / native 110ms = 0.9x speedup
SIMD float-mul (64K x300) java 167ms / native 114ms = 1.4x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 121.000 ms
Base64 CN1 decode 84.000 ms
Base64 native encode 457.000 ms
Base64 encode ratio (CN1/native) 0.265x (73.5% faster)
Base64 native decode 274.000 ms
Base64 decode ratio (CN1/native) 0.307x (69.3% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog

shai-almog commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 210 screenshots: 210 matched.
Native Windows port, REAL shipping pipeline: the hellocodenameone screenshot suite rendered by a binary CROSS-COMPILED on Linux (clang-cl + xwin, WebView2 linked) and RUN on a Windows x64 runner. Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 57ms / native 4ms = 14.2x speedup
SIMD float-mul (64K x300) java 56ms / native 5ms = 11.2x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 80.000 ms
Base64 CN1 decode 109.000 ms
Base64 SIMD encode 111.000 ms
Base64 encode ratio (SIMD/CN1) 1.388x (38.7% slower)
Base64 SIMD decode 107.000 ms
Base64 decode ratio (SIMD/CN1) 0.982x (1.8% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 9.000 ms
Image createMask (SIMD on) 4.000 ms
Image createMask ratio (SIMD on/off) 0.444x (55.6% faster)
Image applyMask (SIMD off) 31.000 ms
Image applyMask (SIMD on) 27.000 ms
Image applyMask ratio (SIMD on/off) 0.871x (12.9% faster)
Image modifyAlpha (SIMD off) 27.000 ms
Image modifyAlpha (SIMD on) 15.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.556x (44.4% faster)
Image modifyAlpha removeColor (SIMD off) 33.000 ms
Image modifyAlpha removeColor (SIMD on) 19.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.576x (42.4% faster)

@shai-almog

shai-almog commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 210 screenshots: 210 matched.
Native Linux port (x64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub x64 runner. Baseline: scripts/linux/screenshots.

ParparVM vs HotSpot (JDK 25): Linux x64

Runner CPU: AMD EPYC 7763 64-Core Processor (baseline linux-x64@amd-epyc-7763-64-core-processor)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 1.07x (base 0.85x, +26.2%) 0.77x (base 0.83x, -7.2%) ok
translator (self) 4 0.57x (base 0.64x, -10.5%) 0.50x (base 0.52x, -4.4%) ok
intArithmetic 4 1.10x (base 1.12x, -1.2%) 0.04x (base 0.06x, -30.3%) ok
longArithmetic 4 1.08x (base 1.08x, +0.0%) 0.04x (base 0.05x, -30.0%) ok
mathTranscendental 4 1.08x (base 1.08x, +0.1%) 0.04x (base 0.07x, -45.0%) ok
arraySequential 4 2.06x (base 2.00x, +3.0%) 0.36x (base 0.36x, +0.7%) ok
arrayRandom 4 1.03x (base 0.91x, +12.7%) 0.20x (base 0.21x, -3.5%) ok
objectAllocation 4 1.55x (base 1.65x, -6.1%) 0.31x (base 0.35x, -12.9%) ok
valueEscape 4 0.10x (base 0.10x, -0.3%) 0.03x (base 0.04x, -34.5%) ok
hashMapChurn 4 1.44x (base 1.48x, -2.9%) 0.11x (base 0.09x, +12.8%) ok
stringBuilding 4 1.29x (base 1.39x, -7.2%) 0.31x (base 0.31x, -0.1%) ok
recursion 4 1.38x (base 1.25x, +10.2%) 0.04x (base 0.08x, -47.6%) ok
quicksort 4 1.08x (base 1.07x, +1.1%) 0.10x (base 0.11x, -12.7%) ok

Result: no regression

@shai-almog

shai-almog commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 210 screenshots: 210 matched.
Native Linux port (arm64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub arm64 runner. Baseline: scripts/linux/screenshots-arm.

ParparVM vs HotSpot (JDK 25): Linux arm64

Runner CPU: Neoverse-N2 (baseline linux-arm64@neoverse-n2)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 1.18x (base 1.02x, +15.2%) 0.78x (base 0.66x, +17.5%) ok
translator (self) 4 0.78x (base 0.70x, +12.1%) 0.47x (base 0.43x, +9.9%) ok
intArithmetic 4 1.04x (base 1.04x, -0.0%) 0.03x (base 0.03x, +4.7%) ok
longArithmetic 4 0.79x (base 0.79x, -0.3%) 0.03x (base 0.03x, +5.3%) ok
mathTranscendental 4 1.09x (base 1.10x, -0.3%) 0.04x (base 0.03x, +9.8%) ok
arraySequential 4 0.42x (base 0.36x, +14.8%) 0.37x (base 0.37x, +0.3%) ok
arrayRandom 4 0.94x (base 0.94x, -0.0%) 0.20x (base 0.20x, +0.9%) ok
objectAllocation 4 2.01x (base 1.77x, +13.5%) 0.36x (base 0.37x, -1.9%) ok
valueEscape 4 0.51x (base 0.51x, -0.1%) 0.03x (base 0.03x, +5.8%) ok
hashMapChurn 4 0.85x (base 0.84x, +0.9%) 0.12x (base 0.12x, +2.3%) ok
stringBuilding 4 1.39x (base 1.57x, -11.0%) 0.32x (base 0.26x, +20.7%) ok
recursion 4 1.56x (base 1.43x, +8.6%) 0.04x (base 0.04x, +3.4%) ok
quicksort 4 1.00x (base 0.99x, +0.5%) 0.10x (base 0.09x, +2.7%) ok

Result: no regression

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • ✅ Tests: 934 total, 0 failed, 55 skipped

Benchmark Results

  • Execution Time: 10582 ms

  • Hotspots (Top 20 sampled methods):

    • 7.67% java.lang.System.identityHashCode (116 samples)
    • 5.82% java.util.ArrayList.indexOf (88 samples)
    • 5.16% java.lang.Object.hashCode (78 samples)
    • 3.64% java.lang.StringBuilder.append (55 samples)
    • 2.84% com.codename1.tools.translator.BytecodeMethod.equals (43 samples)
    • 2.71% com.codename1.tools.translator.bytecodes.Invoke.findMethodUp (41 samples)
    • 2.25% com.codename1.tools.translator.ByteCodeClass.hasDeclaredMethod (34 samples)
    • 1.92% java.util.HashMap.hash (29 samples)
    • 1.85% com.codename1.tools.translator.bytecodes.Invoke.resolveDirectTarget (28 samples)
    • 1.85% com.codename1.tools.translator.BytecodeMethod.optimize (28 samples)
    • 1.72% com.codename1.tools.translator.ByteCodeClass.fillVirtualMethodTable (26 samples)
    • 1.65% java.lang.String.equals (25 samples)
    • 1.52% java.util.HashMap.putVal (23 samples)
    • 1.52% java.util.regex.Pattern$Start.match (23 samples)
    • 1.39% com.codename1.tools.translator.JavascriptReachability.enqueueResolved (21 samples)
    • 1.39% java.io.FileOutputStream.writeBytes (21 samples)
    • 1.39% com.codename1.tools.translator.BytecodeMethod.updateInlinableFieldDependencies (21 samples)
    • 1.32% com.codename1.tools.translator.BytecodeMethod.appendCMethodPrefix (20 samples)
    • 1.26% com.codename1.tools.translator.NativeSymbolIndex.<init> (19 samples)
    • 1.19% java.lang.StringCoding.encode (18 samples)
  • ⚠️ Coverage report not generated.

Static Analysis

  • ✅ SpotBugs: no findings (report was not generated by the build).
  • ⚠️ PMD report not generated.
  • ⚠️ Checkstyle report not generated.

Generated automatically by the PR CI workflow.

@shai-almog
shai-almog merged commit f3b0c33 into master Nov 12, 2026
67 of 74 checks passed
@shai-almog
shai-almog deleted the backend-sse branch November 12, 2026 08:26
@shai-almog

shai-almog commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 95000 ms
Simulator Boot (Run) 1000 ms
App Install 22000 ms
App Launch 11000 ms
Test Execution 484000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 271ms / native 6ms = 45.1x speedup
SIMD float-mul (64K x300) java 283ms / native 20ms = 14.1x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 87.000 ms
Base64 CN1 decode 87.000 ms
Base64 native encode 1528.000 ms
Base64 encode ratio (CN1/native) 0.057x (94.3% faster)
Base64 native decode 1925.000 ms
Base64 decode ratio (CN1/native) 0.045x (95.5% faster)
Base64 SIMD encode 220.000 ms
Base64 encode ratio (SIMD/CN1) 2.529x (152.9% slower)
Base64 SIMD decode 69.000 ms
Base64 decode ratio (SIMD/CN1) 0.793x (20.7% faster)
Base64 encode ratio (SIMD/native) 0.144x (85.6% faster)
Base64 decode ratio (SIMD/native) 0.036x (96.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 6.000 ms
Image createMask (SIMD on) 6.000 ms
Image createMask ratio (SIMD on/off) 1.000x (0.0% slower)
Image applyMask (SIMD off) 415.000 ms
Image applyMask (SIMD on) 43.000 ms
Image applyMask ratio (SIMD on/off) 0.104x (89.6% faster)
Image modifyAlpha (SIMD off) 40.000 ms
Image modifyAlpha (SIMD on) 33.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.825x (17.5% faster)
Image modifyAlpha removeColor (SIMD off) 56.000 ms
Image modifyAlpha removeColor (SIMD on) 58.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.036x (3.6% slower)

@shai-almog

shai-almog commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 196 screenshots: 196 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 56ms / native 3ms = 18.6x speedup
SIMD float-mul (64K x300) java 56ms / native 4ms = 14.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 60.000 ms
Base64 CN1 decode 61.000 ms
Image encode benchmark iterations 100
Image createMask (SIMD off) 12.000 ms
Image createMask (SIMD on) 5.000 ms
Image createMask ratio (SIMD on/off) 0.417x (58.3% faster)
Image applyMask (SIMD off) 65.000 ms
Image applyMask (SIMD on) 64.000 ms
Image applyMask ratio (SIMD on/off) 0.985x (1.5% faster)
Image modifyAlpha (SIMD off) 80.000 ms
Image modifyAlpha (SIMD on) 65.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.813x (18.8% faster)
Image modifyAlpha removeColor (SIMD off) 66.000 ms
Image modifyAlpha removeColor (SIMD on) 58.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.879x (12.1% faster)

ParparVM vs HotSpot (JDK 25): macOS arm64

Runner CPU: Apple M1 (Virtual) (baseline macos-arm64)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (HelloCodenameOne) 3 1.22x (base 0.96x, +27.0%) 0.89x (base 0.93x, -3.9%) ok
translator (self) 3 0.65x (base 0.62x, +4.4%) 0.86x (base 0.78x, +9.4%) ok
intArithmetic 3 1.06x (base 1.03x, +2.8%) 0.12x (base 0.12x, +1.8%) ok
longArithmetic 3 1.04x (base 1.03x, +1.1%) 0.11x (base 0.07x, +63.7%) ok
mathTranscendental 3 0.98x (base 1.01x, -3.0%) 0.12x (base 0.12x, +0.4%) ok
arraySequential 3 0.44x (base 0.42x, +3.6%) 0.53x (base 0.53x, +0.1%) ok
arrayRandom 3 0.98x (base 0.99x, -0.5%) 0.33x (base 0.32x, +0.6%) ok
objectAllocation 3 1.00x (base 1.11x, -9.1%) 0.85x (base 0.72x, +17.2%) ok
valueEscape 3 0.51x (base 0.51x, +0.2%) 0.09x (base 0.09x, -3.4%) ok
hashMapChurn 3 1.06x (base 1.18x, -9.8%) 0.07x (base 0.07x, -2.6%) ok
stringBuilding 3 0.96x (base 0.84x, +14.5%) 0.40x (base 0.46x, -14.3%) ok
recursion 3 1.25x (base 1.24x, +1.4%) 0.12x (base 0.12x, -0.1%) ok
quicksort 3 0.99x (base 1.01x, -1.7%) 0.11x (base 0.11x, -0.0%) ok

Result: no regression

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.

1 participant