Skip to content

Dev - #37

Merged
YuyuZha0 merged 3 commits into
mainfrom
dev
May 15, 2026
Merged

Dev#37
YuyuZha0 merged 3 commits into
mainfrom
dev

Conversation

@YuyuZha0

Copy link
Copy Markdown
Owner

No description provided.

yuyu.zhao and others added 3 commits May 15, 2026 12:04
Ran the pooled benchmark on Corretto 8.0.472 / 11.0.29 / 21.0.9 (same
machine, same JMH config) to put hard numbers behind the older-JDK
speedup claim. Two findings worth pinning:

  * fast-printf's varargs path is JDK-version-invariant (214 → 216 →
    221 ns) — the library owns its performance regardless of Hotspot
    improvements.
  * The Args no-boxing builder is the one fast-printf path that
    materially improves with JDK version (326 → 247 ns); JDK 11+'s
    better small-method inlining helps its chained calls.
  * String.format is the big mover: 1450 → 404 ns from JDK 8 to JDK 21
    (3.6× faster). That alone explains the shrinking relative speedup
    — fast-printf didn't slow down, the JDK closed the gap.

Speedup vs String.format on this workload:
  JDK 8:  varargs 6.77×, TL cache 5.94×
  JDK 11: varargs 4.95×, TL cache 5.38×
  JDK 21: varargs 1.83×, TL cache 2.17×

README:
  - Key Features bullet now lists concrete per-JDK ratios instead of
    "up to 4×".
  - Performance section gains a "Cross-JDK regression" sub-section with
    the full table and the two storylines.

CommonUsageBenchmark Javadoc:
  - Single-JDK result block replaced with a per-JDK regression table.
  - Allocation profile is JDK-21-only (JMH's gc profiler doesn't yield
    reliable B/op numbers on Hotspot 8).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JDK 17 (Corretto 17.0.17) numbers, same machine, same JMH config:

  fastPrintf varargs       199.73 ±11.6 ns  ( 696 B/op)
  fastPrintf Args builder  247.23 ± 4.9 ns  ( 592 B/op)
  fastPrintf TL cache      196.83 ±37.4 ns  ( 608 B/op)
  String.format            885.77 ±65.6 ns  (2776 B/op)

Speedup vs String.format: varargs 4.43×, TL cache 4.50×.

The interesting JDK 17 data point: String.format throughput is already
improving (1069 → 886 ns vs JDK 11) but allocation is the heaviest of
any JDK we measured (2776 B/op). The big drop to 1280 B/op happens in
JDK 21 with the Formatter rewrite.

README:
  - Cross-JDK regression table gains a JDK 17 column.
  - Key Features bullet now reads "~4.5× faster on JDK 17" alongside
    the other version-specific ratios.

CommonUsageBenchmark Javadoc:
  - Result table widened to 4 JDK columns.
  - Allocation profile now shown for JDK 11+, with JDK 17's outlier
    jdkPrintf allocation called out explicitly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The README had grown a redundant trio of value-prop sections (Quick Start
→ Key Features → When to use) and the "Performance (JDK 21)" heading was
misleading after the cross-JDK regression landed. Reflow:

* New top-of-page lead paragraph that front-loads the value prop
  ("1.8–6.8× faster, ~50% less garbage") instead of two near-duplicate
  intro paragraphs.
* "Key Features" + "When to use fast-printf" merged into a single
  "Why fast-printf?" section.
* "Performance (JDK 21)" → "Performance"; leads with an SVG bar chart
  (docs/perf-cross-jdk.svg), then the cross-JDK table, then the JDK 21
  allocation profile, then the design-trade-off notes for Args builder
  and ThreadLocal cache.
* "Advanced: JDK 21 Floating-Point on Java 8" was an orphan single-
  paragraph section — folded into "How It Works" as a subsection where
  it belongs.
* "API Reference" → "Format String Reference" (more descriptive).
* "Key Differences from String.format" → "Differences from String.format".
* TOC updated to match the new ordering.

The chart is a hand-rolled SVG (760×470, three series across four JDK
groups, with value labels). Pure declarative SVG, no scripts — renders
correctly on github.com, in IDE previews, and on Maven Central's README
display.

Net diff: -124 / +107 (≈17 lines shorter overall) plus the new SVG.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.85%. Comparing base (5aa4d41) to head (e9127d9).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #37   +/-   ##
=========================================
  Coverage     95.85%   95.85%           
  Complexity     1094     1094           
=========================================
  Files            57       57           
  Lines          2122     2122           
  Branches        342      342           
=========================================
  Hits           2034     2034           
  Misses           41       41           
  Partials         47       47           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YuyuZha0
YuyuZha0 merged commit 7f2a050 into main May 15, 2026
5 checks passed
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.

2 participants