Skip to content

Commit 93bc91a

Browse files
committed
fix #994: Expand ByteSourceJsonBootstrapper canonicalization performance comment
1 parent b472243 commit 93bc91a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ public JsonParser constructParser(int parserFeatures, ObjectCodec codec,
259259
if (enc == JsonEncoding.UTF8) {
260260
/* and without canonicalization, byte-based approach is not performant; just use std UTF-8 reader
261261
* (which is ok for larger input; not so hot for smaller; but this is not a common case)
262+
* 5-May-2023, ckozak [core#994]: The reader-based implementation under-performs for small inputs
263+
* due to the initialization cost of InputStreamReader which allocates a new 8KiB buffer. Normalizing
264+
* benchmarks for that fixed cost, ReaderBasedJsonParser maintains a performance edge in tested scenarios.
265+
* Notes from this investigation can be found here:
266+
* https://github.com/FasterXML/jackson-core/pull/995#issuecomment-1523912770
262267
*/
263268
if (JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.enabledIn(factoryFeatures)) {
264269
ByteQuadsCanonicalizer can = rootByteSymbols.makeChild(factoryFeatures);

0 commit comments

Comments
 (0)