EDN supported data type much rich than
JSON would be more convenient.
I tested it myself, the tranist & json has same performance in encode. In decode, transit little slower than json.
Transit is heavily optimized for performance, and will be much much faster than directly reading/writing EDN.
Directly comparing it to JSON isn’t entirely fair as it’s a much richer format, transit can also reuse references, so if you have the same piece of data twice inside a bigger data structure, it will only be serialized (and deserialized) once.
It seems you’re mostly looking at the JVM side, but when talking to a browser using ClojureScript Transit also has big benefits over JSON, as it deserializes to ClojureScript data structures directly. This is much faster than first using JSON and then converting it with
I second that about transit and ClojureScript. We saved a lot of start time for our SPA, switching from JSON to transit.
In my tests from a few years ago
(->> str js/JSON.parse js->clj)
was slower than
(->> str transit/read)
Not sure if that’s true anymore, but js->clj used to be very slow, for some reason
Beware of this issue when writing transit to a file on disk: