Skip to content

Improve performance of reasonForReportToBeInOptionList #81900

@mountiny

Description

@mountiny

Coming from here

Background

The Left Hand Navigation (LHN) sidebar displays a list of reports relevant to the user. To determine which reports appear, the system calls a function—reasonForReportToBeInOptionList—for every report during each LHN render. In typical accounts, this can mean hundreds of calls per render. The function performs multiple checks, including data lookups, state evaluations, and conditional logic. Because it runs so frequently, even small inefficiencies compound into noticeable UI delays. The current implementation includes repeated lookups, redundant function calls, and expensive computations that execute regardless of whether they are needed.

Problem

When the LHN render process triggers repeated evaluations of reasonForReportToBeInOptionList across many reports, if the function performs redundant or unnecessarily expensive operations, then overall UI rendering slows down.

Solution

Reorganize the function to minimize unnecessary work and enable faster short‑circuiting:
Reorder conditional checks so the cheapest evaluations occur first, allowing early exit when possible.Cache repeated data lookups and function results within the scope of a single evaluation to avoid recomputing identical values.Defer expensive computations until after all cheaper checks have passed, ensuring they only run when absolutely necessary.

These changes reduce redundant operations and improve the function’s execution time. Measurements show an 8% performance improvement in function’s execution time. Large accounts with many unread reports will benefit the most from these changes.

Issue OwnerCurrent Issue Owner: @elirangoshen

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.MonthlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Status

AWAITING DEPLOYMENT

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions