Skip to content

[Due for payment 2026-06-04] [No QA] perf: avoid full getTransactionDetails per transaction in getBillableAndTaxTotal #91719

@mountiny

Description

@mountiny

Problem

getBillableAndTaxTotal only needs four fields from each transaction (amount, taxAmount, currency, billable) but was calling getTransactionDetails, which materializes the full TransactionDetails object per transaction — including two timezone-aware date formats, attendees, waypoints, MCC group, and more, all immediately discarded. On an expense report with N transactions this was ~2N date-fns timezone format calls thrown away. Flame graph on iOS showed ~1.2s spent in this function on report-open, dominated by getFormattedCreatedformatWithUTCTimeZone.

Solution

Replace getTransactionDetails with direct accessors (getBillable, getTaxAmount, getCurrency, getTransactionAmount), hoist reportCurrency out of the loop, pass isFromExpenseReport = true directly to skip per-transaction report lookups, and short-circuit when both billable and taxAmount are falsy. On a report with 1.6k transactions, getBillableAndTaxTotal time dropped from ~1.2s to ~5ms.

PR

#91716

Issue OwnerCurrent Issue Owner: @Pujan92

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

Status

SUBISSUE

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions