Skip to content
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

JSON omit null #1535

Merged
merged 2 commits into from
Jul 30, 2021
Merged

JSON omit null #1535

merged 2 commits into from
Jul 30, 2021

Conversation

shanshin
Copy link
Contributor

@shanshin shanshin commented Jun 7, 2021

benchmarks

+1.75%	k.b.json.CitmBenchmark.decodeCitm
+0.49%	k.b.json.CitmBenchmark.encodeCitm
-0.82%	k.b.json.CoerceInputValuesBenchmark.testNonNullableCoercing
-0.65%	k.b.json.CoerceInputValuesBenchmark.testNonNullableRegular
-1.89%	k.b.json.CoerceInputValuesBenchmark.testNullableCoercing
+1.22%	k.b.json.CoerceInputValuesBenchmark.testNullableRegular
+1.67%	k.b.json.JacksonComparisonBenchmark.jacksonFromString
+1.76%	k.b.json.JacksonComparisonBenchmark.jacksonSmallToString
-0.71%	k.b.json.JacksonComparisonBenchmark.jacksonToString
+4.49%	k.b.json.JacksonComparisonBenchmark.jacksonToStringWithEscapes
+3.07%	k.b.json.JacksonComparisonBenchmark.kotlinFromString
+0.53%	k.b.json.JacksonComparisonBenchmark.kotlinSmallToString
+4.46%	k.b.json.JacksonComparisonBenchmark.kotlinToString
+2.43%	k.b.json.JacksonComparisonBenchmark.kotlinToStringWithEscapes
+4.89%	k.b.json.PrimitiveValuesBenchmark.decodeBoolean
+0.74%	k.b.json.PrimitiveValuesBenchmark.decodeInt
+6.29%	k.b.json.PrimitiveValuesBenchmark.decodeLong
+1.36%	k.b.json.TwitterBenchmark.decodeTwitter
-0.55%	k.b.json.TwitterBenchmark.encodeTwitter
+3.65%	k.b.json.TwitterFeedBenchmark.decodeMicroTwitter
-1.54%	k.b.json.TwitterFeedBenchmark.decodeMicroTwitterNoAltNames
-0.52%	k.b.json.TwitterFeedBenchmark.decodeTwitter
-1.24%	k.b.json.TwitterFeedBenchmark.decodeTwitterNoAltNames
+1.30%	k.b.json.TwitterFeedBenchmark.encodeTwitter
+15.57%	k.b.protobuf.ProtoBaseline.fromBytes
-4.58%	k.b.protobuf.ProtoBaseline.fromBytesExplicit
+3.49%	k.b.protobuf.ProtoBaseline.toBytes
+3.03%	k.b.protobuf.ProtoBaseline.toBytesExplicit
-0.50%	k.b.protobuf.ProtoHuge.fromBytes130
-1.64%	k.b.protobuf.ProtoHuge.toBytes130
+1.51%	k.b.protobuf.ProtoListBenchmark.fromBytes
-3.79%	k.b.protobuf.ProtoListBenchmark.toBytes
-0.39%	k.b.protobuf.ProtoListLikeBenchmark.fromBytes
+1.45%	k.b.protobuf.ProtoListLikeBenchmark.toBytes

Using omitNull = true flag for JSON's with all fields filled can sometimes slow down performance and increase volatility:

  • TwitterBenchmark.decodeTwitterOmitNull vs TwitterBenchmark.decodeTwitter: -5% .. +1.5%
  • OmitNullBenchmark.decodeNoNullsWithOmit vs OmitNullBenchmark.decodeNoNulls: -4.5% .. -3%
  • OmitNullBenchmark.decodeNullsWithOmit vs OmitNullBenchmark.decodeNulls: -4.7% .. -1%

@shanshin shanshin force-pushed the json-omit-null-195 branch 2 times, most recently from aefa167 to 6867a38 Compare July 15, 2021 10:28
Copy link
Member

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Also filed #1619 for release 1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants