Files
bsky-social-app/patches
Tomek Zawadzki 94cbd85480 Patch @formatjs/bigdecimal with identity fast paths for div/times by 1
ECMA-402's ToRawFixed runs on every Intl.NumberFormat format call and every
Intl.PluralRules select, and both rounding candidates do
`.div(roundingIncrement)` and `.times(roundingIncrement)` where
roundingIncrement defaults to 1. Without a fast path, div(1) performs a
10^34 BigInt scale-up, a BigInt division, and a trailing-zero strip that
undoes the scaling - pure waste that profiled at 7.3% of JS-busy self time
(the `div` frame) during a heavy release-build feed scroll, because this app
force-installs the formatjs polyfill (see src/locale/i18n.ts).

The patch returns the existing immutable instance when multiplying or
dividing by exactly 1 (mantissa 1n, exponent 0 - the normalized
representation of 1).

Verified: byte-identical output across 104,800 assertions (4 locales x 3
option sets x ~8,700 values through NumberFormat.format plus
PluralRules.select), and 2.4x faster per compact format call in Node.

Candidate for upstreaming to formatjs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 13:26:43 +02:00
..
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00
2026-08-18 10:46:11 -04:00