perf(uORB): check for new data before reading the clock in updated()

Assisted-by: Claude:claude-fable-5-1
This commit is contained in:
Lourens Naude authored and Beat Küng committed 2026-10-22 08:26:26 +02:00
1 parent 7bfc32e4de
commit 2a9be29e3c
4 files changed
+143 -7

No files matched your search

@@ -45,13 +45,9 @@ namespace uORB
template <bool ATOMIC>
bool SubscriptionIntervalBase<ATOMIC>::updated()
{
hrt_abstime last_update = _last_update.load();
if (advertised() && (hrt_elapsed_time(&last_update) >= _interval_us.load())) {
return _subscription.updated();
}
return false;
// New data implies advertised(); checking it first keeps the clock read off
// the common no-update path.
return _subscription.updated() && interval_elapsed();
}
template <bool ATOMIC>