Coming from this proposal
Background
The proposal is a react-native-onyx change and comes from recent discussion.
Problem
In OnyxCache implements recentlyAccessedKeys with Array primitive, which has linear performance complexity when reading and iterating over it. Frequent reads and writes to recentlyAccessedKeys could yield negative perf implications.
Solution
Similarly to other OnyxCache properties, recentlyAccessedKeys can be refactored to use Set instead of Array to achieve constant I/O times.
Draft PR: Expensify/react-native-onyx#642
Results
Direct performance tests results for addEvictableKeysToRecentlyAccessedList shows significant reduction in processing duration:
🟢 OnyxUtils addEvictableKeysToRecentlyAccessedList one call adding 1k keys > Duration deviation of -23.93 ms (-95.79%) is within the allowed range of 10.00 ms (20.00%).
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021937282975946938682
- Upwork Job ID: 1937282975946938682
- Last Price Increase: 2025-06-23
Issue Owner
Current Issue Owner: @twisterdotcom
Coming from this proposal
Background
The proposal is a react-native-onyx change and comes from recent discussion.
Problem
In OnyxCache implements recentlyAccessedKeys with Array primitive, which has linear performance complexity when reading and iterating over it. Frequent reads and writes to recentlyAccessedKeys could yield negative perf implications.
Solution
Similarly to other OnyxCache properties, recentlyAccessedKeys can be refactored to use Set instead of Array to achieve constant I/O times.
Draft PR: Expensify/react-native-onyx#642
Results
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @twisterdotcom