Skip to content

Misc perf fixes (toml, yaml) - #713

Open
pjfanning wants to merge 3 commits into
FasterXML:3.xfrom
pjfanning:perf-issues
Open

Misc perf fixes (toml, yaml)#713
pjfanning wants to merge 3 commits into
FasterXML:3.xfrom
pjfanning:perf-issues

Conversation

@pjfanning

Copy link
Copy Markdown
Member

suggested by Claude AI

Performance Fixes

File Fix Impact
yaml/YAMLGenerator.java:691 String.valueOf(v.toString())v.toString() — eliminated redundant String conversion on BigInteger writes High
yaml/YAMLGenerator.java:327 Long.valueOf(id).toString()Long.toString(id) — avoids unnecessary boxing Low
yaml/YAMLGenerator.java:799 Eliminated Optional.of().map().Anchor() chain → direct new Anchor(id.toString()) Medium
toml/TomlParser.java:328-336 Replaced new String().replace().toCharArray() (3 allocations) with single-pass in-place char copy skipping underscores High
toml/TomlParser.java:450 Added indexOf('_') guard before .replace("_", "") — avoids unnecessary String copy on the common case (no underscores) Medium

@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 78.75% 📈 +0.010%
Branches branches 72.67% 📈 +0.030%

Coverage data generated from JaCoCo test results

@cowtowncoder cowtowncoder changed the title add perf fixes Misc perf fixes (toml, yaml) Aug 14, 2026
@cowtowncoder cowtowncoder added yaml Issue related to YAML format backend TOML Issue related to TOML format backend labels Aug 14, 2026
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 78.80% 📈 +0.010%
Branches branches 72.69% 📈 +0.030%

Coverage data generated from JaCoCo test results

@skrcode

skrcode commented Aug 23, 2026

Copy link
Copy Markdown

I ran JAIPilot Cloud against this exact PR head. It found one additional TOML allocation cleanup: compact underscores in place in the parser-owned token buffer instead of allocating a second char array.

The same 113 focused parser tests passed before and after, including a long token that forces buffer growth and a following token that checks for corruption. Five fixed allocation batches on a 10,000-digit underscored integer moved from 551,104 to 524,416 allocated bytes per parse, and the full 1,558-test clean build passed.

PR directly onto this source branch: pjfanning#13
Cloud-generated draft and full evidence: skrcode#2

Only the underscore slow path changes; ordinary integer tokens are untouched, and the long-token fixture is not presented as a production-throughput claim.

…integer literals (#13)

Co-authored-by: jaipilot[bot] <273169020+jaipilot[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 78.80% 📈 +0.010%
Branches branches 72.69% 📈 +0.030%

Coverage data generated from JaCoCo test results

@pjfanning

Copy link
Copy Markdown
Member Author

Thanks @skrcode - that change looks sensible and since it improves the change in my PR, it makes sense to merge it into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TOML Issue related to TOML format backend yaml Issue related to YAML format backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants