mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
perf(uORB): skip subscription lookups until a device node is added (#29249)
While a topic has no device node, every Subscription::update(), copy(), updated() and advertised() repeats the device node lookup and fails again. Polling modules touch many optional topics on every loop: in a SITL flight about 8% of all instructions, and about a quarter of each MAVLink thread, were such failed lookups. Device nodes are never removed, so a lookup that failed cannot succeed before a node is added. Count the nodes added in DeviceMaster and only retry the lookup once that count has changed. Protected builds, where user space has no cheap access to it, keep retrying every time. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
1 parent
8c3b934957
commit
cd2b157682
8 files changed
+67
-2
No files matched your search
@@ -120,6 +120,7 @@ int uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_adver
|
||||
// add to the node map.
|
||||
_node_list.add(node);
|
||||
_node_exists[node->get_instance()].set((orb_id_size_t)node->id(), true);
|
||||
_node_generation.fetch_add(1); // only once the node can be found
|
||||
|
||||
} else {
|
||||
delete node;
|
||||
|
||||
Reference in new issue
Block a user