Skip to content

Commit b6ddb77

Browse files
mgodwanshiv0408
authored andcommitted
Enable Fast Double Parser in Jackson (opensearch-project#7909)
* Enable Fast Double Parser in Jackson Signed-off-by: Mohit Godwani <[email protected]> * Use Fast Double Parser in jackson Signed-off-by: Mohit Godwani <[email protected]> --------- Signed-off-by: Mohit Godwani <[email protected]> Signed-off-by: Mohit Godwani <[email protected]> Signed-off-by: Shivansh Arora <[email protected]>
1 parent 5967f9b commit b6ddb77

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5050
- Change http code for DecommissioningFailedException from 500 to 400 ([#5283](https://github.com/opensearch-project/OpenSearch/pull/5283))
5151
- Improve summary error message for invalid setting updates ([#4792](https://github.com/opensearch-project/OpenSearch/pull/4792))
5252
- Pass localNode info to all plugins on node start ([#7919](https://github.com/opensearch-project/OpenSearch/pull/7919))
53+
- Improved performance of parsing floating point numbers ([#7909](https://github.com/opensearch-project/OpenSearch/pull/7909))
5354

5455
### Deprecated
5556

libs/x-content/src/main/java/org/opensearch/common/xcontent/cbor/CborXContent.java

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.fasterxml.jackson.core.JsonGenerator;
3737
import com.fasterxml.jackson.core.JsonParser;
3838
import com.fasterxml.jackson.core.StreamReadConstraints;
39+
import com.fasterxml.jackson.core.StreamReadFeature;
3940
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
4041
import org.opensearch.core.xcontent.DeprecationHandler;
4142
import org.opensearch.core.xcontent.MediaType;
@@ -75,6 +76,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7576
cborFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false);
7677
cborFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
7778
cborFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
79+
cborFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
7880
cborXContent = new CborXContent();
7981
}
8082

libs/x-content/src/main/java/org/opensearch/common/xcontent/json/JsonXContent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import com.fasterxml.jackson.core.JsonGenerator;
3838
import com.fasterxml.jackson.core.JsonParser;
3939
import com.fasterxml.jackson.core.StreamReadConstraints;
40-
40+
import com.fasterxml.jackson.core.StreamReadFeature;
4141
import org.opensearch.core.xcontent.DeprecationHandler;
4242
import org.opensearch.core.xcontent.MediaType;
4343
import org.opensearch.core.xcontent.NamedXContentRegistry;
@@ -78,6 +78,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7878
jsonFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false);
7979
jsonFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
8080
jsonFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
81+
jsonFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
8182
jsonXContent = new JsonXContent();
8283
}
8384

libs/x-content/src/main/java/org/opensearch/common/xcontent/smile/SmileXContent.java

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.fasterxml.jackson.core.JsonGenerator;
3737
import com.fasterxml.jackson.core.JsonParser;
3838
import com.fasterxml.jackson.core.StreamReadConstraints;
39+
import com.fasterxml.jackson.core.StreamReadFeature;
3940
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
4041
import com.fasterxml.jackson.dataformat.smile.SmileGenerator;
4142
import org.opensearch.core.xcontent.DeprecationHandler;
@@ -77,6 +78,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7778
smileFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false);
7879
smileFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
7980
smileFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
81+
smileFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
8082
smileXContent = new SmileXContent();
8183
}
8284

libs/x-content/src/main/java/org/opensearch/common/xcontent/yaml/YamlXContent.java

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.fasterxml.jackson.core.JsonEncoding;
3636
import com.fasterxml.jackson.core.JsonParser;
3737
import com.fasterxml.jackson.core.StreamReadConstraints;
38+
import com.fasterxml.jackson.core.StreamReadFeature;
3839
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
3940
import org.opensearch.core.xcontent.DeprecationHandler;
4041
import org.opensearch.core.xcontent.NamedXContentRegistry;
@@ -70,6 +71,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7071
yamlFactory = new YAMLFactory();
7172
yamlFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
7273
yamlFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
74+
yamlFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
7375
yamlXContent = new YamlXContent();
7476
}
7577

0 commit comments

Comments
 (0)