Skip to content

[Due for payment 2025-07-30] [Due for payment 2025-07-22] Improve Onyx.set performance with optional flags for derived values #65715

Closed

Description

@TMisiukiewicz

Coming from https://expensify.slack.com/archives/C05LX9D6E07/p1751978498770109

Background
Our app uses a derived value system where values are computed from entire collections. Even when the computation itself is fast (often <5ms), we spend significantly more time (hundreds of milliseconds) inside Onyx internals when writing these large derived values to storage.

Problem
Onyx.set isn’t optimized for large objects like derived values. It performs a deep equality check against the cached value and recursively removes nulls, both of which become performance bottlenecks as object size grows.

Solution
Add an options parameter to Onyx.set with two flags:

  • skipCacheCheck: skips the deep equality check
  • skipNullRemoval: skips pruning null values

For derived values, we fully control their lifecycle and recompute them when any dependency changes - so we know the value is new and don’t need a deep comparison. Also, null may be a legitimate result of the computation, so pruning it is unnecessary. Skipping these two checks significantly improves performance when working with large objects.

Comparison made on a derived value we should have merged soon in this PR: #65247
Before: 165ms
After: <5ms

Issue OwnerCurrent Issue Owner: @VictoriaExpensify

Activity

  1. TMisiukiewicz commented on Jul 9, 2025

    @TMisiukiewicz
    ContributorAuthor
  2. 18 remaining items

  3. melvin-bot commented on Jul 22, 2025

    @melvin-bot

    Issue is ready for payment but no BZ is assigned. @VictoriaExpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

  4. melvin-bot commented on Jul 22, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@VictoriaExpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  5. changed the title [-][Due for payment 2025-07-22] Improve Onyx.set performance with optional flags for derived values[/-] [+][Due for payment 2025-07-30] [Due for payment 2025-07-22] Improve Onyx.set performance with optional flags for derived values[/+] on Jul 23, 2025
  6. melvin-bot commented on Jul 23, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  7. melvin-bot commented on Jul 23, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.84-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-07-30. 🎊

    For reference, here are some details about the assignees on this issue:

  8. VictoriaExpensify commented on Aug 1, 2025

    @VictoriaExpensify
    Contributor

    Payment summary:
    C: @parasharrajat owed $250 via NewDot
    C+: @TMisiukiewicz - contractor, no payment due

  9. parasharrajat commented on Sep 3, 2025

    @parasharrajat
    Member

    Payment requested as per #65715 (comment)

  10. quinthar commented on Sep 15, 2025

    @quinthar
    Contributor

    Approved $250 to @parasharrajat

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

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions