question

petajoule avatar image
petajoule asked

dbus script unbearably slow

While it is possible to use the dbus script, its performance is beyond good and evil.

root@ccgx:~# time dbus -y com.victronenergy.system /Ac/ConsumptionOnOutput/L1/Power GetValue
506

real    0m1.619s
user    0m1.099s
sys     0m0.161s

I mean ... almost 1.7 seconds for something that should have been a simple IPC query. What's going on there?

Would have expected something at least an order of magnitude faster, especially as things like querying /sys/bus go two orders of magnitude faster:

root@ccgx:~# time cat /sys/bus/gpio/devices/gpiochip0/power/control 
auto

real    0m0.018s
user    0m0.001s
sys     0m0.013s


Something really smells in that dbus script.

Venus OS
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

petajoule avatar image petajoule commented ·

By the way: with 2.40~37 it's consistently 0.1s slower.

It's definitely the mere startup cost of the script. Even a mere "dbus -h" has that runtime.

0 Likes 0 ·
2 Answers
petajoule avatar image
petajoule answered ·

Much better:

root@ccgx:/run/media/mmcblk0p2# time dbus-send --print-reply --system --dest=com.victronenergy.system /Ac/ConsumptionOnOutput/L1/Power com.victronenergy.BusItem.GetValue
method return time=1574337322.269601 sender=:1.29 -> destination=:1.663 serial=21275 reply_serial=2
   variant       int32 643

real    0m0.064s
user    0m0.000s
sys     0m0.021s

Parsing the value out of there will take bash less than 1.7 seconds. ;-)

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

jeroen avatar image
jeroen answered ·

python... again python otherwise the answer is too short..

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources