From 04c9caf3a39af6e7c6ce1e30ce21d30a531b5264 Mon Sep 17 00:00:00 2001 From: Mohit Godwani Date: Mon, 5 Jun 2023 16:36:54 +0530 Subject: [PATCH] Enable Fast Double Parser in Jackson Signed-off-by: Mohit Godwani --- .../org/opensearch/common/xcontent/json/JsonXContent.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libs/x-content/src/main/java/org/opensearch/common/xcontent/json/JsonXContent.java b/libs/x-content/src/main/java/org/opensearch/common/xcontent/json/JsonXContent.java index 8ff8e7730b189..4504dff6fddd2 100644 --- a/libs/x-content/src/main/java/org/opensearch/common/xcontent/json/JsonXContent.java +++ b/libs/x-content/src/main/java/org/opensearch/common/xcontent/json/JsonXContent.java @@ -32,11 +32,7 @@ package org.opensearch.common.xcontent.json; -import com.fasterxml.jackson.core.JsonEncoding; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.core.*; import org.opensearch.core.xcontent.DeprecationHandler; import org.opensearch.core.xcontent.MediaType; @@ -78,6 +74,8 @@ public static XContentBuilder contentBuilder() throws IOException { jsonFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false); jsonFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); jsonFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build()); + jsonFactory.configure(JsonParser.Feature.USE_FAST_DOUBLE_PARSER, true); + jsonFactory.configure(StreamWriteFeature.USE_FAST_DOUBLE_WRITER.mappedFeature(), true); jsonXContent = new JsonXContent(); }