When using the cpp link, bootloading a Crazyflie is very slow:
$ time make cload
Python:
real 0m31.702s
user 0m3.389s
sys 0m1.176s
CPP:
real 4m42.991s
user 0m7.673s
sys 0m18.203s
The behavior seems to come from send packet that can either take 1 seconds or run in quick bursts of ~30 packets. This looks like mutex contension so I tried commenting this mutex lock:
|
const std::lock_guard<std::mutex> lock(con->queue_send_mutex_); |
. Doing so solves the problem, I can then bootloader as fast as with the python link.
Why does this mutex exists? I though there was only one thread accessing each radio which means that radio access would not need to be protected by a lock. I will continue investigating, tell me if you have any though @whoenig.
When using the cpp link, bootloading a Crazyflie is very slow:
The behavior seems to come from send packet that can either take 1 seconds or run in quick bursts of ~30 packets. This looks like mutex contension so I tried commenting this mutex lock:
crazyflie-link-cpp/src/CrazyradioThread.cpp
Line 227 in e6043eb
Why does this mutex exists? I though there was only one thread accessing each radio which means that radio access would not need to be protected by a lock. I will continue investigating, tell me if you have any though @whoenig.