-
Notifications
You must be signed in to change notification settings - Fork 495
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
[BUG] 对于JavaBean的序列化速度比Fastjson1要慢 #609
Comments
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.11-SNAPSHOT/ Benchmark Mode Cnt Score Error Units
Issue609.fastJSON1ArrayDeThroughput thrpt 5 39.779 ± 5.517 ops/s
Issue609.fastJSON2ArrayDeThroughput thrpt 5 68.184 ± 5.387 ops/s
Issue609.fastJSON1ArraySeThroughput thrpt 5 42.854 ± 1.831 ops/s
Issue609.fastJSON2ArraySeThroughput thrpt 5 56.745 ± 0.564 ops/s
Issue609.fastJSON1ObjDeThroughput thrpt 5 68.175 ± 0.566 ops/s
Issue609.fastJSON2ObjDeThroughput thrpt 5 100.525 ± 1.874 ops/s
Issue609.fastJSON1ObjSeThroughput thrpt 5 62.280 ± 0.869 ops/s
Issue609.fastJSON2ObjSeThroughput thrpt 5 92.590 ± 2.127 ops/s
Issue609.fastJSON1ArrayDeTime avgt 5 29.628 ± 12.199 ms/op
Issue609.fastJSON2ArrayDeTime avgt 5 15.280 ± 0.636 ms/op
Issue609.fastJSON2ArraySeTime avgt 5 17.026 ± 0.227 ms/op
Issue609.fastJSON1ArraySeTime avgt 5 23.259 ± 0.866 ms/op
Issue609.fastJSON1ObjDeTime avgt 5 15.204 ± 0.225 ms/op
Issue609.fastJSON2ObjDeTime avgt 5 9.907 ± 0.066 ms/op
Issue609.fastJSON1ObjSeTime avgt 5 16.105 ± 0.277 ms/op
Issue609.fastJSON2ObjSeTime avgt 5 10.677 ± 0.117 ms/op |
刚刚用2.0.11-SNAPSHOT又跑了两次,还是fastjson1快一些
第二次:
|
能提供下你跑benchmark的环境信息么?比如硬件、内存、JDK版本、JVM参数配置 |
已经在最开始提供了 |
我debug了序列化的逻辑,发现最终执行的是ObjectWriterAdpter的write方法
其中的FieldWriter的write方法在本次benchmark中对应FieldWriterStringMethod和FieldWriterInt32,对应的write方法要考虑UTF8,我猜测可能这是慢的原因之一。
|
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.12-SNAPSHOT/ |
👍 |
问题描述
对于JavaBean的序列化速度比Fastjson1要慢,同时在去掉JSONWriter.Feature.ReferenceDetection之后,会出现OutOfMemoryError。于之对应的,Fastjson1只是偶尔出现OutOfMemoryError。
环境信息
请填写以下信息:
重现步骤
https://gist.github.com/xinhochen/36f1d0cce97ae765aa9fa127833f2166
期待的正确结果
Fastjson2的序列化吞吐量和耗时优于Fastjson1
相关日志输出
附加信息
无
The text was updated successfully, but these errors were encountered: