Skip to content

perf(dataman): Speed up DatamanCache lookups with a search hint#27805

Open
JonasPerolini wants to merge 1 commit into
PX4:mainfrom
JonasPerolini:dataman-opti
Open

perf(dataman): Speed up DatamanCache lookups with a search hint#27805
JonasPerolini wants to merge 1 commit into
PX4:mainfrom
JonasPerolini:dataman-opti

Conversation

@JonasPerolini

Copy link
Copy Markdown
Contributor

This PR changes DatamanCache::loadWait() to scan from the last successful cache hit instead of always starting at slot 0.

This keeps sequential and repeated mission item reads close to O(1) in the common case while preserving the same fallback behavior on cache misses.

Linked to #27707 where the plan is to have the full route in the cache. In this case starting from the last hit can become significant.

@github-actions github-actions Bot added the kind:improvement Change that improves existing behavior. label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 24 byte (0 %)]
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +24  +0.0%     +24    .text
    +9.0%     +24  +9.0%     +24    DatamanCache::loadWait()
    +5.9%      +2  +5.9%      +2    DatamanCache::changeUpdateIndex()
    +5.3%      +2  +5.3%      +2    DatamanCache::invalidate()
    -1.6%      -4  -1.6%      -4    FeasibilityChecker::checkTakeoffLandAvailable()
  +0.0%     +72  [ = ]       0    .debug_abbrev
  +0.0%    +136  [ = ]       0    .debug_info
  -0.0%      -8  [ = ]       0    .debug_line
    [DEL]      -5  [ = ]       0    [Unmapped]
    -0.0%      -3  [ = ]       0    [section .debug_line]
  +0.0%     +21  [ = ]       0    .debug_loclists
  +0.0%      +7  [ = ]       0    .debug_rnglists
    +100%      +1  [ = ]       0    [Unmapped]
    +0.0%      +6  [ = ]       0    [section .debug_rnglists]
  +0.0%      +8  [ = ]       0    .debug_str
  -0.3%     -24  [ = ]       0    [Unmapped]
  +0.0%    +236  +0.0%     +24    TOTAL

px4_fmu-v6x [Total VM Diff: 24 byte (0 %)]
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +24  +0.0%     +24    .text
    +9.0%     +24  +9.0%     +24    DatamanCache::loadWait()
    +5.9%      +2  +5.9%      +2    DatamanCache::changeUpdateIndex()
    +5.3%      +2  +5.3%      +2    DatamanCache::invalidate()
    -1.6%      -4  -1.6%      -4    FeasibilityChecker::checkTakeoffLandAvailable()
  +0.0%     +72  [ = ]       0    .debug_abbrev
  +0.0%    +136  [ = ]       0    .debug_info
  +0.0%     +33  [ = ]       0    .debug_loclists
  +0.0%      +3  [ = ]       0    .debug_rnglists
    [DEL]      -3  [ = ]       0    [Unmapped]
    +0.0%      +6  [ = ]       0    [section .debug_rnglists]
  +0.0%      +8  [ = ]       0    .debug_str
  -0.4%     -24  [ = ]       0    [Unmapped]
  +0.0%    +252  +0.0%     +24    TOTAL

Updated: 2026-07-03T18:46:45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:improvement Change that improves existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant