[Bug]: Android launch spends ~2 s in formatjs polyfill checks before the first render
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- android, react-native, typescript
- Bereich
- internationalization, mobile, performance
Rechercherichtung
Beginne in apps/mobile/src/i18n/intl-polyfills.ts, wo die Polyfills für DisplayNames und PluralRules aus ihren Standard-Einstiegspunkten importiert werden. Das Issue berichtet, dass die erzwungenen Einstiegspunkte (polyfill-force) dieselben APIs ohne die Prüfung der Locale-Übereinstimmung installieren, die den Start verlangsamt. Stelle die Imports um und prüfe, dass Intl.DisplayNames.polyfilled true ist, dass PluralRules('en').select(1) 'one' zurückgibt und dass DisplayNames für 'fr' 'French' zurückgibt. Fertig ist, wenn sich die Auswertungszeit der Imports auf einem Android-Release-Build verringert, gemessen mit am start -W.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/mobile
Steps to reproduce
- Install a release Android build.
- Force-stop the app, then launch it (
adb shell am start -W -n <package>/.MainActivity). - Time the splash screen.
Expected behavior
The splash hides within about a second or two of the first JS line on a current phone.
Actual behavior
On a Pixel 9 Pro the splash stays up 5.3 to 6.1 s. Timing logs in a release build show about 3.0 s spent evaluating the JS import graph before App renders anything.
Timing each module's first evaluation (a profiling polyfill around Metro's __d) puts the two largest costs in apps/mobile/src/i18n/intl-polyfills.ts:
| Module | Self time (emulator, production bundle) |
|---|---|
@formatjs/intl-displaynames/polyfill.js |
619 ms |
@formatjs/intl-pluralrules/polyfill.js |
243 ms |
Both default entries call shouldPolyfill() at import. With no native Intl.DisplayNames or Intl.PluralRules (Hermes has neither), that runs @formatjs/intl-localematcher's match(['en'], <~700 supported locales>, 'en'). Every comparison goes through the JS getCanonicalLocales polyfill, and the result is always "polyfill".
Importing the forced entries instead (@formatjs/intl-displaynames/polyfill-force and @formatjs/intl-pluralrules/polyfill-force) installs the same polyfills without the check. Measured on the same phone:
| Default entries | polyfill-force |
|
|---|---|---|
| JS import evaluation | 2.98 to 3.08 s | 0.75 to 0.96 s |
Tap to splash gone (am start -W) |
5.3 to 6.1 s | 1.7 s warm, 2.5 to 3.6 s cold |
Both APIs still install and work afterwards (Intl.DisplayNames.polyfilled === true, new Intl.PluralRules('en').select(1) === 'one', new Intl.DisplayNames(['en'], { type: 'language' }).of('fr') === 'French').
Impact
Major degradation or frequent failure
Version or commit
apps/mobile/src/i18n/intl-polyfills.ts as of c3a330d834 (unchanged in the fork build measured)
Environment
Pixel 9 Pro, Android 17 (GrapheneOS), Battery Saver on, release build; module timings from a production bundle on an Android 17 emulator
Logs or stack traces
Next-largest import costs after the change: React Native's BridgelessUIManager collecting legacy view-manager constants (~400 ms on the emulator), global.css, and Effect / packages/contracts schema setup.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 24.8k
- Forks
- 6.4k
- Ø Merge
- 2 Std. 18 Min.
- Gemergte PRs (30 T.)
- 448
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus pingdotgg/t3code
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
pingdotgg/t3code#40678 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug]: Gitea/Forgejo mergeable:false maps to unknown, so PR watch never reports merge conflictsEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug]: Link dialog copy uses "here"/"there" instead of host names, so the access direction is ambiguousEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in pingdotgg/t3code
Ähnliche Issues
-
[Docs] CONTRIBUTING points the Backend Remake milestone at a branch that does not existEvtl. vergeben @franpts2 hat das heute übernommen. Offendocs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
ever-co/ever-teams#5741 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
melgarafael/DeskcommCRM#5142 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug size:medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag