Skip to content

[Due for payment 2025-07-14] [$250] Use Set for recentlyAccessedKeys in onyx #64773

@mountiny

Description

@mountiny

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 OwnerCurrent Issue Owner: @twisterdotcom

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions