-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade fastjson to 2.0.51 #104
Conversation
run
Outdated
@@ -3,7 +3,7 @@ | |||
JAR=build/libs/app.jar | |||
HEAP_SIZE=2g | |||
|
|||
[ -z ${JVM_OPTIONS} ] && JVM_OPTIONS="-server -Xms${HEAP_SIZE} -Xmx${HEAP_SIZE} --add-opens=java.base/java.time=ALL-UNNAMED --add-modules=jdk.incubator.vector" | |||
[ -z ${JVM_OPTIONS} ] && JVM_OPTIONS="-server -Xms${HEAP_SIZE} -Xmx${HEAP_SIZE} --add-opens=java.base/java.time=ALL-UNNAMED --add-modules=jdk.incubator.vector -Dfastjson2.features=disableReferenceDetect,disableArrayMapping,disableJSONB,disableAutoType,disableSmartMatch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these fastjson2 options documented somewhere? and why they are safe to use in a production environment? Why would they not be set by default if they are safe?
Moreover, it would be preferable to introduce Java code/class (via System.setProperty) to increase the visibility that these options are used, and optionally to find a way to run fastjson2_optimized vs fastjson2_default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fastjson provides many functions that other json libraries do not have. These options can be turned off on demand and can be used in a production environment. There is a Chinese document introducing it.
The current version only supports global opening or closing. Serde that provides per-instance configuration options will be provided in the next version (2.0.51)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait for 2.0.51 then. When it's ready, let's introduce a new FASTJSON2_OPTIMIZED implementation in Library
, etc. so default vs optimized fastjson2 can be compared side by side (jackson has 3 such cases).
I read the docs and using these flags seem to require in-depth knowledge of certain fastjson2 features to be useful, so best to keep it isolated from the default fastjson2 behavior (whatever that may be).
It has been updated to version 2.0.51, and non-default test methods have been added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the benchmark showing both fastjson2 and fastjson2_features results for ser and deser.
static final ObjectReaderProvider featuresProvider = new ObjectReaderProvider(); | ||
static final JSONReader.Context featuresContext; | ||
static { | ||
featuresProvider.setDisableArrayMapping(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot find such methods when searching on github / fastjson2. Can you provide a link to show me where these are published/pushed?
src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java
Outdated
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you for the contribution.
fastjson 2.0.50 once again improves performance. fastjson 2.0.50 provides configuration parameters that do not generate unnecessary code during JIT to improve performance. Configuration parameters can be set through the API or configured through JVM startup parameters.
This PR upgrades the fastjson version and enables JVM startup parameters to improve performance.