D-Bus Versus Varlink
Zeeshan Ali Khan
zeeshanak at gnome.org
Thu Mar 21 15:23:04 UTC 2024
Hi Thiago,
On Thu, 21 Mar 2024 at 16:09, Thiago Macieira <thiago at kde.org> wrote:
>
> On Thursday, 21 March 2024 06:56:18 PDT Zeeshan Ali Khan wrote:
> > While I was a bit skeptical about the claim that JSON
> > encoding/decoding is only a small fish compared to the effects of
> > context switching, my own benchmarks convinced me that to be true:
> > https://toot.cat/@zeenix/111971114434573026
>
> This basically showed that CBOR is better in almost all benchmarks. So why use
> JSON if you can use CBOR?
Disclaimer: I don't think JSON is a good choice at all. It's just what
Varlink already uses and the important bit is that the effect of JSON
is nowhere comparable to effects of context switching.
Also, to keep in mind that my hope when writing the benchmarks, was to
demonstrate the opposite of the results I ended up with.
> Also, suggestion for benchmarking: non-US-ASCII strings. I'm also not seeing
> any floating point numbers in your data. When you add those, add short and long
> strings and numbers (for example, pass 1e15 as "1000000000000000.000000").
> There's also a need for passing binary data, which JSON will require encoding
> as base64 and the encoding and decoding of that should be attributed to JSON,
> not the caller.
Good points. Although I doubt I'll be able to get time to add that any
time soon. PRs welcome of course.
> Have you tested nested maps and arrays? One of the things that JSON does a lot
> is to have arrays of objects that repeat the same keys over and over again:
> [
> {
> "name1": value1,
> "name2": value2
> }, {
> "name1": value3,
> "name2": value4
> }
> ]
>
> Would be nice to compare that with and without the optional CBOR string
> compression. This would match a D-Bus aa{sv}, which aren't used as often as
> what the web and cloud use JSON arrays of objects.
Also good point but no, I have not yet tested those cases.
--
Regards,
Zeeshan Ali Khan
More information about the dbus
mailing list