recently, I have been having some discussions with @pid_eins about D-Bus vs. Varlink. He made a point that the efficiency of the encoding isn't in the end, as important as the effects of context switching, given that the modern chips are super efficient at parsing and copying data, but not really good at context switching.
I knew that there is a lot of truth to that but I wanted to find out how much so I did some benchmarking:
https://github.com/zeenix/json-vs-bin
Turns out, he's absolutely right on money.
P.S. No, don't worry. This doesn't mean I'll abandon my D-Bus work/plans. D-Bus is not going anywhere anytime soon and the world still needs easy and safe implementations of it.
@zeenix @pid_eins I've not seen varlink before. Looks like it doesn't support passing file descriptors? Which many DBus interferences need.
DBus, Wayland, Pipewire and the like all implement different systems for typed messages over Unix sockets that can contain file descriptors. It would be nice if there was one standard for that, with an IDL, and possibly a better kernel API (microkernel APIs like `mach_msg` are worth comparing).
But we're kind of stuck supporting what exists.
@pid_eins @ids1024 mind you that in D-Bus, the FDs aren't passed as payload either and rather through a socket option. D-Bus just provides a type to send over the integer indices of the FDs vector sent through an out-of-band method (currently only possibly through the socket option AFAIK) to make things easier.