[Bug]: Android launch spends ~2 s in formatjs polyfill checks before the first render
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- android, react-native, typescript
- Lĩnh vực
- internationalization, mobile, performance
Hướng nghiên cứu
Bắt đầu từ apps/mobile/src/i18n/intl-polyfills.ts, nơi các polyfill DisplayNames và PluralRules được import từ các entry mặc định. Issue báo cáo rằng các entry bắt buộc (polyfill-force) cài đặt cùng các API nhưng không có bước kiểm tra khớp locale, vốn làm chậm khởi động. Hãy chuyển các import và xác nhận rằng Intl.DisplayNames.polyfilled là true, PluralRules('en').select(1) trả về 'one', và DisplayNames của 'fr' trả về 'French'. Việc được coi là hoàn thành khi thời gian đánh giá các import giảm trên bản build release Android, đo bằng am start -W.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 24.8k
- Fork
- 6.4k
- Merge trung bình
- 2 giờ 18 phút
- Pull request đã merge (30 ngày)
- 448
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pingdotgg/t3code
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
pingdotgg/t3code#40678 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Gitea/Forgejo mergeable:false maps to unknown, so PR watch never reports merge conflictsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Sidebar project filter uses Shift-click instead of ⌘-click to add or remove a projectĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Link dialog copy uses "here"/"there" instead of host names, so the access direction is ambiguousCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pingdotgg/t3code
Issue tương tự
-
[Docs] CONTRIBUTING points the Backend Remake milestone at a branch that does not existCó thể đã có người làm @franpts2 đã nhận hôm nay. Đang mởdocs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ever-co/ever-teams#5741 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
melgarafael/DeskcommCRM#5142 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Web mention picker gives same-name bots and routines or connectors identical accessible namesĐang mởbug size:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày