-
Notifications
You must be signed in to change notification settings - Fork 408
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
Which CBOR library to use ? (Jackson, CBOR-JAVA) #939
Comments
Currently my feeling is Jackson would be better but COSE-JAVA don't support it which could be critical issue. |
One note on performance: while I am not aware of independent evaluation, Jackson project itself uses this: https://github.com/FasterXML/jackson-benchmarks/ to compare relative performances of backends: CBOR implementation is somewhat faster for same (smallish) test content than JSON; maybe 30-40% faster to deserialize, and similar for writing. |
I change a little bit the table above ☝️ and now it's maybe less clear that Jackson is more appropriate. |
jackson cbor doesn't support the full spec and due to it's JSON root it's not easy to support features like tags: in general non json concept are not well (or not at all) mapped in jackson cbor. I don't like the way jackson hide some details about the encoding and try to make cbor feel like json where there is much more complexity in cbor (finite vs infinite length encoding, tags for date etc..) |
Jackson is not CBOR-specific (nor necessarily JSON any more) and due to supporting multiple formats there are definitely trade-offs. Most users do not really care about most of low-level details of encoding formats (and details vary across formats), but if access to format-specific details is important then CBOR-only libraries have their benefits for sure. This is similar to question of XML-specific tools (DOM trees) vs higher-level databinding like JAXB or Jackson XML module -- latter is significantly more convenient for most use cases, but to do that will encapsulate many of details. Use of former will couple users to specific format and typically require more knowledge, make users care about such details. The question, then, is: is Leshan's focus on using CBOR for communication, or doing something else? How much do users really care about underlying format(s)? Is format focus of API design (usually it isn't): or should design accommodate maybe multiple access formats (f.ex to support clients that might prefer format like json or yaml for simple textual access). Anyway some food for thought. |
Some more news from CBOR-Java and most of issues detected will be fixed soon. |
We finally go to CBOR-JAVA. |
Current state :
Currently we have decoder/encoders based on both implemenation available in the repository but we should not keep both for the stable release. (to limit library dependencies)
Note we are currently at the beginning of the development phase for 2.0.0 and we release milestone regularly, for now if those milestones contains both implementation this is not a problem. So this is most a long term issue.
Why both implementation ?
SenML CBOR was a contribution from @cavenaghi9 and it choose Jackson as CBOR implementation.
OSCORE support is currently in development (by @rikard-sics) and based on californium-oscore which depends on CBOR-JAVA.
I don't know the initial reason about Jackson choice.
CBOR-Java choice is because COSE-JAVA will be needed and depends on it. (see #866 (comment) for more details)
Which should we choose ?
This is a comparison table to help to do the better choice.
(Note : clearlydefined sounds to prefer Jackson than CBOR-Java:com.upokecenter/cbor, this can make integration in eclipse project faster.)
The text was updated successfully, but these errors were encountered: