Croway opened a new pull request, #26304: URL: https://github.com/apache/camel/pull/26304
With the default `prettyPrint=true`, `groovyJson` rendered the document with `JsonOutput.toJson` and then re-lexed the whole text with `JsonOutput.prettyPrint` (a regex tokenizer): 60.8 µs per 1 KB document vs 1.9 µs for Jackson, 55.6 ms and 243 MB allocated per 1 MB document. This replaces it with a single-pass pretty writer that walks maps, iterables and arrays with the 4-space layout of `JsonOutput.prettyPrint`, formats strings, integral numbers, finite doubles and booleans directly with the escaping of `JsonOutput`, and delegates dates, big numbers, enums and POJOs to `JsonOutput.toJson`. Output is byte-identical to `JsonOutput.prettyPrint(JsonOutput.toJson(doc))`, asserted on 14 documents. Bytes are now written with the exchange charset (UTF-8 default) instead of the platform default. **Measured.** 1 KB 60.8 → 2.7 µs (22×), 1 MB 55.6 → 3.1 ms (18×); compact output unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) _Claude Code on behalf of Croway_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
