Skip to content

Commit

Permalink
fix #994: Expand ByteSourceJsonBootstrapper canonicalization performa…
Browse files Browse the repository at this point in the history
…nce comment
  • Loading branch information
carterkozak committed May 5, 2023
1 parent b472243 commit 93bc91a
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -259,6 +259,11 @@ public JsonParser constructParser(int parserFeatures, ObjectCodec codec,
if (enc == JsonEncoding.UTF8) {
/* and without canonicalization, byte-based approach is not performant; just use std UTF-8 reader
* (which is ok for larger input; not so hot for smaller; but this is not a common case)
* 5-May-2023, ckozak [core#994]: The reader-based implementation under-performs for small inputs
* due to the initialization cost of InputStreamReader which allocates a new 8KiB buffer. Normalizing
* benchmarks for that fixed cost, ReaderBasedJsonParser maintains a performance edge in tested scenarios.
* Notes from this investigation can be found here:
* https://github.com/FasterXML/jackson-core/pull/995#issuecomment-1523912770
*/
if (JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.enabledIn(factoryFeatures)) {
ByteQuadsCanonicalizer can = rootByteSymbols.makeChild(factoryFeatures);
Expand Down

0 comments on commit 93bc91a

Please sign in to comment.