-
Notifications
You must be signed in to change notification settings - Fork 4
Add jackson-cbor, jackson-smile, jsoniter-scala, and kryo-macros #8
Conversation
Table format could really helpful |
|
||
/** https://github.com/plokhotnyuk/jsoniter-scala */ | ||
object JsoniterScalaConverter extends MyConverter { | ||
private[this] val writerConfig = WriterConfig(preferredBufSize = 131072) |
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.
Such size of a buffer seems like a hack. Other libraries do reallocations during serialization/deserialization.
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.
It is not a hack, it is using a provided feature for a competitive advantage)
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.
@plokhotnyuk that's benchmarks-aware ad hocs
@dkomanov maybe you need to add 1Mb records ;)
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.
Using of preallocated thread-local buffers with the capacity that is enough for expected workload is a normal practice for any parformance-aware parser/serializer.
BTW, jsoniter-scala is able to serialize huge messages efficiently using ~32K buffers in the writeToStream
routine:
https://github.com/plokhotnyuk/jsoniter-scala/blob/master/jsoniter-scala-core/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/package.scala#L190
Hi, thanks for your contribution. I hope I will have some time next week to review and update benchmarks. |
Please also consider removing of the maven build configuration. Staying with sbt only it will be much easy to add more libs (avro, colfer, msgpack, bson, smile etc.), automate code generation, run benchmarks for different Scala versions, and use compile-time optimizations that depend on version of |
I have added benchmarks for Jackson CBOR and updated results, which I got on the Linux desktop (previous results was from the notebook). |
It looks that jsoniter-scala is quite competitive with binary protocol libraries...
Below are results of benchmarks that I got on the following environment:
Intel® Core™ i7-7700 CPU @ 3.6GHz (max 4.2GHz), RAM 16Gb DDR4-2400, Ubuntu 16.04, Linux desktop 4.13.0-32-generic, Oracle JDK 64-bit (builds 1.8.0_161-b12)