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

Protocol buffers test skewed by Joda LocalDate string conversions #7

Closed
phensley opened this Issue Jun 25, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@phensley
Copy link

phensley commented Jun 25, 2015

I ran the benchmark under a profiler and noticed the Protobuf side of the test was dominated by Joda string conversions. The Jackson converter uses the LocalDate numeric fields directly, which is far more efficient than formatting / parsing strings on the Protocol Buffers side. Given the large number of LocalDate fields this makes the PB benchmark perform far slower.

I put together a quick test consisting of only basic types and found proto3 to be about 5 times faster than Jackson on both serialization and deserialization. My results are here: https://github.com/phensley/protobuf-vs-jackson

@egillespie

This comment has been minimized.

Copy link
Owner

egillespie commented Jun 25, 2015

Nice catch! Which profiler did you use? I'd like to reproduce your findings before fixing the date conversion code.

@egillespie egillespie self-assigned this Jun 25, 2015

@egillespie egillespie added the bug label Jun 25, 2015

@phensley

This comment has been minimized.

Copy link

phensley commented Jun 25, 2015

No problem -- I used the Oracle VisualVM cpu profiler. It has a "hot spots" view.

@egillespie

This comment has been minimized.

Copy link
Owner

egillespie commented Jun 26, 2015

I swapped out LocalDate and the String conversion with Instant and millis. As @phensley noticed, this was majorly skewing the results in favor of Jackson and this change totally flips the results of the benchmarks! 👍

Shame on me for not paying better attention to the serialized data too, I should have noticed that the Joda Time module was converting LocalDate to number parts instead of to a String. 😦

@egillespie egillespie closed this Jun 26, 2015

@krishna81m

This comment has been minimized.

Copy link

krishna81m commented Oct 6, 2015

Are the conclusions in the main page still applicable that https://code.google.com/p/protobuf-json/ is much faster than FasterXML Jackson library? I am a bit confused if we are comparing the right data as your article says "JSON" serializers/deserializers comparison.

@egillespie

This comment has been minimized.

Copy link
Owner

egillespie commented Oct 6, 2015

@krishna81m Based on the last execution of the tests, Google Protocol Buffers is serializing faster than Jackson JSON, even with Afterburner.

Anywhere that I use the term "JSON" is specific to Jackson. Most of the time I even use the fully-qualified term "Jackson JSON" to try to make it clear that the tests are comparing the performance of the library serialization and deserialization into their respective data formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment