D-Bus Versus Varlink

Thiago Macieira thiago at kde.org
Thu Mar 21 15:09:21 UTC 2024


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?

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.

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.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Principal Engineer - Intel DCAI Cloud Engineering





More information about the dbus mailing list