Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(refactor) Improve code splits further across apps #1472

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

denniskigen
Copy link
Member

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Related: #1468

This PR makes changes to several index.ts files across apps converting synchronous component imports to asynchronous ones using dynamic imports. This refactoring improves performance by reducing the initial bundle size and improving the page load time. With the additional code splitting, components are only loaded when they are actually needed. Key changes include:

  • Replacing getSyncLifecycle with getAsyncLifecycle and dynamic imports.
  • Removing direct component imports from index.ts files.

Screenshots

Related Issue

Other

This PR makes changes to several `index.ts` files across apps converting synchronous component imports to asynchronous ones using dynamic imports. This refactoring improves performance by reducing the initial bundle size and improving the page load time. With the additional code splitting, components are only loaded when they are actually needed. Key changes include:

- Replacing `getSyncLifecycle` with `getAsyncLifecycle` and dynamic imports.
- Removing direct component imports from `index.ts` files.
Copy link
Contributor

github-actions bot commented Jan 27, 2025

Size Change: -1.99 MB (-24.07%) 🎉

Total Size: 6.28 MB

Filename Size Change
packages/esm-active-visits-app/dist/136.js 0 B -65.6 kB (removed) 🏆
packages/esm-active-visits-app/dist/316.js 0 B -42.9 kB (removed) 🏆
packages/esm-active-visits-app/dist/460.js 16.1 kB +15.3 kB (+1868.18%) 🆘
packages/esm-active-visits-app/dist/6.js 0 B -28.1 kB (removed) 🏆
packages/esm-active-visits-app/dist/main.js 3.97 kB -92.1 kB (-95.86%) 🏆
packages/esm-patient-list-management-app/dist/548.js 0 B -58.6 kB (removed) 🏆
packages/esm-patient-list-management-app/dist/900.js 0 B -115 kB (removed) 🏆
packages/esm-patient-list-management-app/dist/main.js 4.67 kB -171 kB (-97.34%) 🏆
packages/esm-patient-registration-app/dist/46.js 0 B -133 kB (removed) 🏆
packages/esm-patient-registration-app/dist/591.js 0 B -16.8 kB (removed) 🏆
packages/esm-patient-registration-app/dist/697.js 0 B -71.6 kB (removed) 🏆
packages/esm-patient-registration-app/dist/main.js 114 kB -90.7 kB (-44.27%) 🎉
packages/esm-patient-search-app/dist/51.js 0 B -106 kB (removed) 🏆
packages/esm-patient-search-app/dist/591.js 0 B -16.8 kB (removed) 🏆
packages/esm-patient-search-app/dist/750.js 0 B -60.9 kB (removed) 🏆
packages/esm-patient-search-app/dist/main.js 4.1 kB -164 kB (-97.56%) 🏆
packages/esm-service-queues-app/dist/6578.js 0 B -179 kB (removed) 🏆
packages/esm-service-queues-app/dist/9993.js 0 B -100 kB (removed) 🏆
packages/esm-service-queues-app/dist/main.js 6.54 kB -274 kB (-97.67%) 🏆
packages/esm-ward-app/dist/main.js 4.89 kB -93.9 kB (-95.06%) 🏆
ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/106.js 0 B -8.63 kB (removed) 🏆
packages/esm-active-visits-app/dist/130.js 396 kB 0 B
packages/esm-active-visits-app/dist/1325.js 3.09 kB 0 B
packages/esm-active-visits-app/dist/16.js 0 B -614 B (removed) 🏆
packages/esm-active-visits-app/dist/1644.js 804 B 0 B
packages/esm-active-visits-app/dist/1793.js 65.1 kB 0 B
packages/esm-active-visits-app/dist/1814.js 3.04 kB 0 B
packages/esm-active-visits-app/dist/1901.js 612 B 0 B
packages/esm-active-visits-app/dist/2016.js 613 B 0 B
packages/esm-active-visits-app/dist/233.js 0 B -3.37 kB (removed) 🏆
packages/esm-active-visits-app/dist/236.js 705 B 0 B
packages/esm-active-visits-app/dist/240.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/261.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/271.js 0 B -805 B (removed) 🏆
packages/esm-active-visits-app/dist/272.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/2725.js 9.13 kB 0 B
packages/esm-active-visits-app/dist/2757.js 727 B 0 B
packages/esm-active-visits-app/dist/2784.js 2.62 kB 0 B
packages/esm-active-visits-app/dist/319.js 0 B -735 B (removed) 🏆
packages/esm-active-visits-app/dist/323.js 0 B -920 B (removed) 🏆
packages/esm-active-visits-app/dist/325.js 0 B -3.09 kB (removed) 🏆
packages/esm-active-visits-app/dist/336.js 0 B -614 B (removed) 🏆
packages/esm-active-visits-app/dist/3574.js 613 B 0 B
packages/esm-active-visits-app/dist/3652.js 613 B 0 B
packages/esm-active-visits-app/dist/378.js 0 B -731 B (removed) 🏆
packages/esm-active-visits-app/dist/4233.js 3.37 kB 0 B
packages/esm-active-visits-app/dist/4272.js 613 B 0 B
packages/esm-active-visits-app/dist/4378.js 729 B 0 B
packages/esm-active-visits-app/dist/443.js 6.98 kB 0 B
packages/esm-active-visits-app/dist/4460.js 816 B 0 B
packages/esm-active-visits-app/dist/4705.js 613 B 0 B
packages/esm-active-visits-app/dist/497.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/5240.js 613 B 0 B
packages/esm-active-visits-app/dist/5336.js 613 B 0 B
packages/esm-active-visits-app/dist/539.js 613 B 0 B
packages/esm-active-visits-app/dist/566.js 0 B -717 B (removed) 🏆
packages/esm-active-visits-app/dist/5673.js 613 B 0 B
packages/esm-active-visits-app/dist/5711.js 613 B 0 B
packages/esm-active-visits-app/dist/5737.js 613 B 0 B
packages/esm-active-visits-app/dist/574.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/579.js 0 B -614 B (removed) 🏆
packages/esm-active-visits-app/dist/5833.js 764 B 0 B
packages/esm-active-visits-app/dist/5962.js 805 B 0 B
packages/esm-active-visits-app/dist/5967.js 9.08 kB 0 B
packages/esm-active-visits-app/dist/644.js 0 B -806 B (removed) 🏆
packages/esm-active-visits-app/dist/6497.js 613 B 0 B
packages/esm-active-visits-app/dist/652.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/6566.js 715 B 0 B
packages/esm-active-visits-app/dist/6727.js 613 B 0 B
packages/esm-active-visits-app/dist/673.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/705.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/711.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/725.js 0 B -655 B (removed) 🏆
packages/esm-active-visits-app/dist/727.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/737.js 0 B -615 B (removed) 🏆
packages/esm-active-visits-app/dist/7401.js 14.4 kB 0 B
packages/esm-active-visits-app/dist/744.js 843 B 0 B
packages/esm-active-visits-app/dist/757.js 0 B -729 B (removed) 🏆
packages/esm-active-visits-app/dist/7807.js 957 B 0 B
packages/esm-active-visits-app/dist/784.js 0 B -2.63 kB (removed) 🏆
packages/esm-active-visits-app/dist/788.js 0 B -628 B (removed) 🏆
packages/esm-active-visits-app/dist/807.js 0 B -959 B (removed) 🏆
packages/esm-active-visits-app/dist/814.js 0 B -3.04 kB (removed) 🏆
packages/esm-active-visits-app/dist/8271.js 804 B 0 B
packages/esm-active-visits-app/dist/8316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/8319.js 734 B 0 B
packages/esm-active-visits-app/dist/8323.js 919 B 0 B
packages/esm-active-visits-app/dist/833.js 0 B -765 B (removed) 🏆
packages/esm-active-visits-app/dist/8788.js 626 B 0 B
packages/esm-active-visits-app/dist/879.js 0 B -3.02 kB (removed) 🏆
packages/esm-active-visits-app/dist/8842.js 1.24 kB 0 B
packages/esm-active-visits-app/dist/8879.js 3.02 kB 0 B
packages/esm-active-visits-app/dist/899.js 611 B 0 B
packages/esm-active-visits-app/dist/901.js 0 B -614 B (removed) 🏆
packages/esm-active-visits-app/dist/9261.js 613 B 0 B
packages/esm-active-visits-app/dist/9579.js 612 B 0 B
packages/esm-active-visits-app/dist/962.js 0 B -807 B (removed) 🏆
packages/esm-active-visits-app/dist/967.js 0 B -611 B (removed) 🏆
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.51 kB +11 B (+0.31%)
packages/esm-appointments-app/dist/1142.js 7.99 kB 0 B
packages/esm-appointments-app/dist/130.js 396 kB 0 B
packages/esm-appointments-app/dist/1325.js 3.08 kB 0 B
packages/esm-appointments-app/dist/1644.js 2.36 kB 0 B
packages/esm-appointments-app/dist/1901.js 2.04 kB 0 B
packages/esm-appointments-app/dist/2.js 2.23 kB 0 B
packages/esm-appointments-app/dist/2016.js 2.04 kB 0 B
packages/esm-appointments-app/dist/2341.js 2.13 kB 0 B
packages/esm-appointments-app/dist/236.js 2.05 kB 0 B
packages/esm-appointments-app/dist/2753.js 24.4 kB 0 B
packages/esm-appointments-app/dist/2757.js 2.44 kB 0 B
packages/esm-appointments-app/dist/2784.js 2.62 kB 0 B
packages/esm-appointments-app/dist/2923.js 4.75 kB 0 B
packages/esm-appointments-app/dist/310.js 45.4 kB 0 B
packages/esm-appointments-app/dist/3260.js 23.3 kB 0 B
packages/esm-appointments-app/dist/3372.js 2.57 kB 0 B
packages/esm-appointments-app/dist/3525.js 2.9 kB 0 B
packages/esm-appointments-app/dist/3574.js 2.05 kB 0 B
packages/esm-appointments-app/dist/3581.js 10.9 kB 0 B
packages/esm-appointments-app/dist/3652.js 2.05 kB 0 B
packages/esm-appointments-app/dist/3952.js 1.62 kB 0 B
packages/esm-appointments-app/dist/4272.js 2.04 kB 0 B
packages/esm-appointments-app/dist/4378.js 2.31 kB 0 B
packages/esm-appointments-app/dist/443.js 6.97 kB 0 B
packages/esm-appointments-app/dist/4460.js 2.49 kB 0 B
packages/esm-appointments-app/dist/4705.js 2.05 kB 0 B
packages/esm-appointments-app/dist/5240.js 2.04 kB 0 B
packages/esm-appointments-app/dist/529.js 2.71 kB 0 B
packages/esm-appointments-app/dist/5336.js 2.04 kB 0 B
packages/esm-appointments-app/dist/539.js 2.05 kB 0 B
packages/esm-appointments-app/dist/5530.js 1.16 kB 0 B
packages/esm-appointments-app/dist/5578.js 881 B 0 B
packages/esm-appointments-app/dist/5673.js 2.05 kB 0 B
packages/esm-appointments-app/dist/5711.js 2.04 kB 0 B
packages/esm-appointments-app/dist/5737.js 2.04 kB 0 B
packages/esm-appointments-app/dist/5833.js 2.36 kB 0 B
packages/esm-appointments-app/dist/5910.js 33.9 kB 0 B
packages/esm-appointments-app/dist/5962.js 2.21 kB 0 B
packages/esm-appointments-app/dist/6179.js 4.25 kB 0 B
packages/esm-appointments-app/dist/646.js 13.5 kB 0 B
packages/esm-appointments-app/dist/6497.js 2.05 kB 0 B
packages/esm-appointments-app/dist/6566.js 2.32 kB 0 B
packages/esm-appointments-app/dist/6591.js 16.8 kB 0 B
packages/esm-appointments-app/dist/6727.js 2.04 kB 0 B
packages/esm-appointments-app/dist/681.js 11 kB 0 B
packages/esm-appointments-app/dist/744.js 2.58 kB 0 B
packages/esm-appointments-app/dist/7775.js 38.1 kB 0 B
packages/esm-appointments-app/dist/7807.js 2.67 kB 0 B
packages/esm-appointments-app/dist/8090.js 94.7 kB 0 B
packages/esm-appointments-app/dist/8199.js 114 kB 0 B
packages/esm-appointments-app/dist/8271.js 2.44 kB 0 B
packages/esm-appointments-app/dist/8316.js 42.9 kB 0 B
packages/esm-appointments-app/dist/8319.js 2.31 kB 0 B
packages/esm-appointments-app/dist/8323.js 2.04 kB 0 B
packages/esm-appointments-app/dist/8607.js 577 B 0 B
packages/esm-appointments-app/dist/8788.js 2.04 kB 0 B
packages/esm-appointments-app/dist/899.js 2.04 kB 0 B
packages/esm-appointments-app/dist/9002.js 1.53 kB 0 B
packages/esm-appointments-app/dist/9173.js 25.3 kB 0 B
packages/esm-appointments-app/dist/9190.js 7.36 kB 0 B
packages/esm-appointments-app/dist/9261.js 2.04 kB 0 B
packages/esm-appointments-app/dist/9269.js 10.8 kB 0 B
packages/esm-appointments-app/dist/9579.js 2.04 kB 0 B
packages/esm-appointments-app/dist/9874.js 4.24 kB 0 B
packages/esm-appointments-app/dist/9890.js 571 B 0 B
packages/esm-appointments-app/dist/main.js 7.91 kB 0 B
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.6 kB 0 B
packages/esm-bed-management-app/dist/130.js 396 kB 0 B
packages/esm-bed-management-app/dist/148.js 1.44 kB 0 B
packages/esm-bed-management-app/dist/16.js 985 B 0 B
packages/esm-bed-management-app/dist/236.js 986 B 0 B
packages/esm-bed-management-app/dist/240.js 987 B 0 B
packages/esm-bed-management-app/dist/261.js 987 B 0 B
packages/esm-bed-management-app/dist/271.js 987 B 0 B
packages/esm-bed-management-app/dist/272.js 986 B 0 B
packages/esm-bed-management-app/dist/288.js 51.3 kB 0 B
packages/esm-bed-management-app/dist/319.js 1.12 kB 0 B
packages/esm-bed-management-app/dist/323.js 987 B 0 B
packages/esm-bed-management-app/dist/325.js 3.09 kB 0 B
packages/esm-bed-management-app/dist/336.js 987 B 0 B
packages/esm-bed-management-app/dist/378.js 1.15 kB 0 B
packages/esm-bed-management-app/dist/443.js 6.97 kB 0 B
packages/esm-bed-management-app/dist/460.js 1.08 kB 0 B
packages/esm-bed-management-app/dist/497.js 988 B 0 B
packages/esm-bed-management-app/dist/539.js 986 B 0 B
packages/esm-bed-management-app/dist/542.js 396 B 0 B
packages/esm-bed-management-app/dist/566.js 1.17 kB 0 B
packages/esm-bed-management-app/dist/574.js 987 B 0 B
packages/esm-bed-management-app/dist/579.js 987 B 0 B
packages/esm-bed-management-app/dist/591.js 16.8 kB 0 B
packages/esm-bed-management-app/dist/644.js 1.2 kB 0 B
packages/esm-bed-management-app/dist/652.js 988 B 0 B
packages/esm-bed-management-app/dist/673.js 988 B 0 B
packages/esm-bed-management-app/dist/705.js 987 B 0 B
packages/esm-bed-management-app/dist/711.js 986 B 0 B
packages/esm-bed-management-app/dist/727.js 987 B 0 B
packages/esm-bed-management-app/dist/737.js 987 B 0 B
packages/esm-bed-management-app/dist/744.js 1.21 kB 0 B
packages/esm-bed-management-app/dist/746.js 125 kB 0 B
packages/esm-bed-management-app/dist/757.js 1.13 kB 0 B
packages/esm-bed-management-app/dist/768.js 28.5 kB 0 B
packages/esm-bed-management-app/dist/784.js 2.63 kB 0 B
packages/esm-bed-management-app/dist/788.js 986 B 0 B
packages/esm-bed-management-app/dist/807.js 987 B 0 B
packages/esm-bed-management-app/dist/833.js 1.15 kB 0 B
packages/esm-bed-management-app/dist/899.js 985 B 0 B
packages/esm-bed-management-app/dist/901.js 986 B 0 B
packages/esm-bed-management-app/dist/962.js 987 B 0 B
packages/esm-bed-management-app/dist/main.js 4.27 kB 0 B
packages/esm-bed-management-app/dist/openmrs-esm-bed-management-app.js 3.42 kB 0 B
packages/esm-patient-list-management-app/dist/106.js 13.4 kB 0 B
packages/esm-patient-list-management-app/dist/130.js 396 kB 0 B
packages/esm-patient-list-management-app/dist/16.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/233.js 3.38 kB 0 B
packages/esm-patient-list-management-app/dist/236.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/240.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/257.js 1.41 kB 0 B
packages/esm-patient-list-management-app/dist/261.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/271.js 1.6 kB 0 B
packages/esm-patient-list-management-app/dist/272.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/319.js 1.53 kB 0 B
packages/esm-patient-list-management-app/dist/323.js 1.62 kB 0 B
packages/esm-patient-list-management-app/dist/325.js 3.09 kB 0 B
packages/esm-patient-list-management-app/dist/336.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/37.js 14.4 kB +1.88 kB (+14.96%) ⚠️
packages/esm-patient-list-management-app/dist/378.js 1.55 kB 0 B
packages/esm-patient-list-management-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-list-management-app/dist/460.js 1.71 kB 0 B
packages/esm-patient-list-management-app/dist/497.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/537.js 553 B 0 B
packages/esm-patient-list-management-app/dist/539.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/566.js 1.54 kB 0 B
packages/esm-patient-list-management-app/dist/574.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/579.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-management-app/dist/598.js 46.1 kB 0 B
packages/esm-patient-list-management-app/dist/640.js 113 kB 0 B
packages/esm-patient-list-management-app/dist/644.js 1.58 kB 0 B
packages/esm-patient-list-management-app/dist/646.js 2.87 kB 0 B
packages/esm-patient-list-management-app/dist/652.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/673.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/681.js 824 B 0 B
packages/esm-patient-list-management-app/dist/705.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/711.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/727.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/737.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/744.js 1.72 kB 0 B
packages/esm-patient-list-management-app/dist/757.js 1.59 kB 0 B
packages/esm-patient-list-management-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-list-management-app/dist/788.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/807.js 1.83 kB 0 B
packages/esm-patient-list-management-app/dist/814.js 3.05 kB 0 B
packages/esm-patient-list-management-app/dist/833.js 1.6 kB 0 B
packages/esm-patient-list-management-app/dist/899.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/901.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/962.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/openmrs-esm-patient-list-management-app.js 3.48 kB 0 B
packages/esm-patient-registration-app/dist/112.js 62.9 kB 0 B
packages/esm-patient-registration-app/dist/130.js 396 kB +226 B (+0.06%)
packages/esm-patient-registration-app/dist/1325.js 3.09 kB 0 B
packages/esm-patient-registration-app/dist/1552.js 11 kB 0 B
packages/esm-patient-registration-app/dist/16.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/1644.js 2.48 kB 0 B
packages/esm-patient-registration-app/dist/169.js 0 B -6.71 kB (removed) 🏆
packages/esm-patient-registration-app/dist/1901.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/2.js 2.24 kB 0 B
packages/esm-patient-registration-app/dist/2016.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/236.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/240.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/261.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/2635.js 460 B 0 B
packages/esm-patient-registration-app/dist/271.js 0 B -2.52 kB (removed) 🏆
packages/esm-patient-registration-app/dist/272.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/2757.js 2.49 kB 0 B
packages/esm-patient-registration-app/dist/2784.js 2.63 kB 0 B
packages/esm-patient-registration-app/dist/319.js 0 B -2.43 kB (removed) 🏆
packages/esm-patient-registration-app/dist/323.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/325.js 0 B -3.09 kB (removed) 🏆
packages/esm-patient-registration-app/dist/336.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/3372.js 2.57 kB 0 B
packages/esm-patient-registration-app/dist/3574.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/3652.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/371.js 0 B -547 B (removed) 🏆
packages/esm-patient-registration-app/dist/372.js 0 B -2.57 kB (removed) 🏆
packages/esm-patient-registration-app/dist/378.js 0 B -2.38 kB (removed) 🏆
packages/esm-patient-registration-app/dist/4272.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/4378.js 2.38 kB 0 B
packages/esm-patient-registration-app/dist/4460.js 2.52 kB 0 B
packages/esm-patient-registration-app/dist/460.js 0 B -2.52 kB (removed) 🏆
packages/esm-patient-registration-app/dist/4705.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/497.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/501.js 0 B -7.03 kB (removed) 🏆
packages/esm-patient-registration-app/dist/5240.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/5336.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/539.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/5501.js 7.03 kB 0 B
packages/esm-patient-registration-app/dist/5657.js 1.21 kB 0 B
packages/esm-patient-registration-app/dist/566.js 0 B -2.47 kB (removed) 🏆
packages/esm-patient-registration-app/dist/5673.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/5711.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/5737.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/574.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/579.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/5833.js 2.4 kB 0 B
packages/esm-patient-registration-app/dist/5962.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/623.js 0 B -1.28 kB (removed) 🏆
packages/esm-patient-registration-app/dist/639.js 103 kB 0 B
packages/esm-patient-registration-app/dist/644.js 0 B -2.48 kB (removed) 🏆
packages/esm-patient-registration-app/dist/6497.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/652.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/6566.js 2.47 kB 0 B
packages/esm-patient-registration-app/dist/657.js 0 B -1.21 kB (removed) 🏆
packages/esm-patient-registration-app/dist/6591.js 16.8 kB 0 B
packages/esm-patient-registration-app/dist/6727.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/673.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/705.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/7083.js 307 B 0 B
packages/esm-patient-registration-app/dist/711.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/727.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/737.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/744.js 2.58 kB 0 B
packages/esm-patient-registration-app/dist/7443.js 31 kB 0 B
packages/esm-patient-registration-app/dist/757.js 0 B -2.49 kB (removed) 🏆
packages/esm-patient-registration-app/dist/7623.js 1.28 kB 0 B
packages/esm-patient-registration-app/dist/7807.js 2.74 kB 0 B
packages/esm-patient-registration-app/dist/784.js 0 B -2.63 kB (removed) 🏆
packages/esm-patient-registration-app/dist/788.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/807.js 0 B -2.74 kB (removed) 🏆
packages/esm-patient-registration-app/dist/8271.js 2.52 kB 0 B
packages/esm-patient-registration-app/dist/8319.js 2.43 kB 0 B
packages/esm-patient-registration-app/dist/8323.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/833.js 0 B -2.4 kB (removed) 🏆
packages/esm-patient-registration-app/dist/8788.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/879.js 0 B -3.03 kB (removed) 🏆
packages/esm-patient-registration-app/dist/8879.js 3.02 kB 0 B
packages/esm-patient-registration-app/dist/899.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/901.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/9261.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/9579.js 2.12 kB 0 B
packages/esm-patient-registration-app/dist/962.js 0 B -2.12 kB (removed) 🏆
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.51 kB -6 B (-0.17%)
packages/esm-patient-search-app/dist/1175.js 5.92 kB 0 B
packages/esm-patient-search-app/dist/130.js 396 kB 0 B
packages/esm-patient-search-app/dist/1314.js 36.6 kB 0 B
packages/esm-patient-search-app/dist/1325.js 3.09 kB 0 B
packages/esm-patient-search-app/dist/1327.js 867 B 0 B
packages/esm-patient-search-app/dist/16.js 0 B -936 B (removed) 🏆
packages/esm-patient-search-app/dist/1644.js 1.17 kB 0 B
packages/esm-patient-search-app/dist/1814.js 3.05 kB 0 B
packages/esm-patient-search-app/dist/1901.js 933 B 0 B
packages/esm-patient-search-app/dist/2.js 2.23 kB 0 B
packages/esm-patient-search-app/dist/2016.js 935 B 0 B
packages/esm-patient-search-app/dist/233.js 0 B -3.37 kB (removed) 🏆
packages/esm-patient-search-app/dist/236.js 936 B 0 B
packages/esm-patient-search-app/dist/240.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/261.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/271.js 0 B -1.14 kB (removed) 🏆
packages/esm-patient-search-app/dist/272.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/2757.js 1.14 kB 0 B
packages/esm-patient-search-app/dist/2784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/319.js 0 B -1.07 kB (removed) 🏆
packages/esm-patient-search-app/dist/323.js 0 B -936 B (removed) 🏆
packages/esm-patient-search-app/dist/325.js 0 B -3.09 kB (removed) 🏆
packages/esm-patient-search-app/dist/336.js 0 B -936 B (removed) 🏆
packages/esm-patient-search-app/dist/3372.js 2.57 kB 0 B
packages/esm-patient-search-app/dist/3574.js 935 B 0 B
packages/esm-patient-search-app/dist/3652.js 935 B 0 B
packages/esm-patient-search-app/dist/372.js 0 B -2.57 kB (removed) 🏆
packages/esm-patient-search-app/dist/378.js 0 B -1.1 kB (removed) 🏆
packages/esm-patient-search-app/dist/3955.js 8.88 kB 0 B
packages/esm-patient-search-app/dist/4013.js 11.7 kB 0 B
packages/esm-patient-search-app/dist/4233.js 3.37 kB 0 B
packages/esm-patient-search-app/dist/4272.js 935 B 0 B
packages/esm-patient-search-app/dist/4378.js 1.1 kB 0 B
packages/esm-patient-search-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-search-app/dist/4460.js 1.15 kB 0 B
packages/esm-patient-search-app/dist/460.js 0 B -1.16 kB (removed) 🏆
packages/esm-patient-search-app/dist/4705.js 935 B 0 B
packages/esm-patient-search-app/dist/497.js 0 B -936 B (removed) 🏆
packages/esm-patient-search-app/dist/5240.js 935 B 0 B
packages/esm-patient-search-app/dist/5336.js 934 B 0 B
packages/esm-patient-search-app/dist/539.js 935 B 0 B
packages/esm-patient-search-app/dist/566.js 0 B -1.09 kB (removed) 🏆
packages/esm-patient-search-app/dist/5673.js 935 B 0 B
packages/esm-patient-search-app/dist/5711.js 935 B 0 B
packages/esm-patient-search-app/dist/5737.js 934 B 0 B
packages/esm-patient-search-app/dist/574.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/579.js 0 B -936 B (removed) 🏆
packages/esm-patient-search-app/dist/5833.js 1.1 kB 0 B
packages/esm-patient-search-app/dist/5962.js 935 B 0 B
packages/esm-patient-search-app/dist/6357.js 16 kB 0 B
packages/esm-patient-search-app/dist/644.js 0 B -1.17 kB (removed) 🏆
packages/esm-patient-search-app/dist/6497.js 934 B 0 B
packages/esm-patient-search-app/dist/652.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/6566.js 1.09 kB 0 B
packages/esm-patient-search-app/dist/6591.js 16.8 kB 0 B
packages/esm-patient-search-app/dist/6727.js 934 B 0 B
packages/esm-patient-search-app/dist/673.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/705.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/711.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/727.js 0 B -936 B (removed) 🏆
packages/esm-patient-search-app/dist/7332.js 8.13 kB 0 B
packages/esm-patient-search-app/dist/737.js 0 B -936 B (removed) 🏆
packages/esm-patient-search-app/dist/744.js 1.17 kB 0 B
packages/esm-patient-search-app/dist/757.js 0 B -1.14 kB (removed) 🏆
packages/esm-patient-search-app/dist/7807.js 1.23 kB 0 B
packages/esm-patient-search-app/dist/784.js 0 B -2.63 kB (removed) 🏆
packages/esm-patient-search-app/dist/788.js 0 B -933 B (removed) 🏆
packages/esm-patient-search-app/dist/807.js 0 B -1.23 kB (removed) 🏆
packages/esm-patient-search-app/dist/814.js 0 B -3.05 kB (removed) 🏆
packages/esm-patient-search-app/dist/8271.js 1.14 kB 0 B
packages/esm-patient-search-app/dist/8319.js 1.07 kB 0 B
packages/esm-patient-search-app/dist/8323.js 934 B 0 B
packages/esm-patient-search-app/dist/833.js 0 B -1.1 kB (removed) 🏆
packages/esm-patient-search-app/dist/8788.js 931 B 0 B
packages/esm-patient-search-app/dist/8842.js 3.04 kB 0 B
packages/esm-patient-search-app/dist/899.js 933 B 0 B
packages/esm-patient-search-app/dist/901.js 0 B -935 B (removed) 🏆
packages/esm-patient-search-app/dist/9261.js 935 B 0 B
packages/esm-patient-search-app/dist/9513.js 92.8 kB 0 B
packages/esm-patient-search-app/dist/9579.js 933 B 0 B
packages/esm-patient-search-app/dist/9611.js 4.33 kB 0 B
packages/esm-patient-search-app/dist/962.js 0 B -937 B (removed) 🏆
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.52 kB +13 B (+0.37%)
packages/esm-service-queues-app/dist/1006.js 4.06 kB +1.56 kB (+62.33%) 🆘
packages/esm-service-queues-app/dist/1060.js 1.82 kB 0 B
packages/esm-service-queues-app/dist/130.js 396 kB 0 B
packages/esm-service-queues-app/dist/1325.js 3.09 kB 0 B
packages/esm-service-queues-app/dist/1644.js 3.54 kB 0 B
packages/esm-service-queues-app/dist/1727.js 8.83 kB +210 B (+2.44%)
packages/esm-service-queues-app/dist/1800.js 3.99 kB +1.57 kB (+64.79%) 🆘
packages/esm-service-queues-app/dist/1901.js 2.98 kB 0 B
packages/esm-service-queues-app/dist/1912.js 3.45 kB 0 B
packages/esm-service-queues-app/dist/2.js 0 B -2.23 kB (removed) 🏆
packages/esm-service-queues-app/dist/2016.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/2067.js 38 kB 0 B
packages/esm-service-queues-app/dist/236.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/2757.js 3.7 kB 0 B
packages/esm-service-queues-app/dist/2760.js 14 kB +6.28 kB (+81.77%) 🆘
packages/esm-service-queues-app/dist/2764.js 4.33 kB 0 B
packages/esm-service-queues-app/dist/2784.js 2.62 kB 0 B
packages/esm-service-queues-app/dist/3199.js 1.36 kB 0 B
packages/esm-service-queues-app/dist/3256.js 23.4 kB 0 B
packages/esm-service-queues-app/dist/3341.js 1.71 kB 0 B
packages/esm-service-queues-app/dist/3372.js 2.57 kB -2 B (-0.08%)
packages/esm-service-queues-app/dist/3574.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/3604.js 13.2 kB +5.87 kB (+79.82%) 🆘
packages/esm-service-queues-app/dist/3649.js 2.52 kB 0 B
packages/esm-service-queues-app/dist/3652.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/3818.js 7.53 kB +4.97 kB (+194.29%) 🆘
packages/esm-service-queues-app/dist/3828.js 1.38 kB 0 B
packages/esm-service-queues-app/dist/4272.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/4378.js 3.45 kB 0 B
packages/esm-service-queues-app/dist/443.js 6.98 kB 0 B
packages/esm-service-queues-app/dist/4460.js 3.74 kB 0 B
packages/esm-service-queues-app/dist/4568.js 5.62 kB 0 B
packages/esm-service-queues-app/dist/4705.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/4911.js 8.46 kB +699 B (+9.01%) 🔍
packages/esm-service-queues-app/dist/5236.js 13.1 kB +6.72 kB (+105.75%) 🆘
packages/esm-service-queues-app/dist/5240.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/5282.js 14.4 kB +4.87 kB (+51.27%) 🆘
packages/esm-service-queues-app/dist/5336.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/539.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/543.js 340 B 0 B
packages/esm-service-queues-app/dist/5673.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/5711.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/5737.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/5833.js 3.53 kB 0 B
packages/esm-service-queues-app/dist/5962.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/6497.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/6566.js 3.48 kB 0 B
packages/esm-service-queues-app/dist/6591.js 16.8 kB 0 B
packages/esm-service-queues-app/dist/6670.js 17.9 kB +7.5 kB (+71.87%) 🆘
packages/esm-service-queues-app/dist/6727.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/6992.js 14.3 kB 0 B
packages/esm-service-queues-app/dist/7242.js 219 B 0 B
packages/esm-service-queues-app/dist/744.js 3.7 kB 0 B
packages/esm-service-queues-app/dist/752.js 3.95 kB +1.57 kB (+66.37%) 🆘
packages/esm-service-queues-app/dist/7569.js 12.1 kB 0 B
packages/esm-service-queues-app/dist/7807.js 3.99 kB 0 B
packages/esm-service-queues-app/dist/8271.js 3.6 kB 0 B
packages/esm-service-queues-app/dist/8313.js 173 kB 0 B
packages/esm-service-queues-app/dist/8319.js 3.4 kB 0 B
packages/esm-service-queues-app/dist/8323.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/8788.js 3 kB 0 B
packages/esm-service-queues-app/dist/8879.js 3.02 kB 0 B
packages/esm-service-queues-app/dist/899.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/9259.js 16.3 kB 0 B
packages/esm-service-queues-app/dist/9261.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/9392.js 10 kB +1.83 kB (+22.31%) 🚨
packages/esm-service-queues-app/dist/940.js 23.4 kB 0 B
packages/esm-service-queues-app/dist/9521.js 11.6 kB 0 B
packages/esm-service-queues-app/dist/9579.js 2.99 kB 0 B
packages/esm-service-queues-app/dist/9646.js 13.7 kB 0 B
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.47 kB -3 B (-0.09%)
packages/esm-ward-app/dist/130.js 396 kB 0 B
packages/esm-ward-app/dist/1325.js 3.08 kB 0 B
packages/esm-ward-app/dist/1576.js 7.89 kB +1.85 kB (+30.59%) 🚨
packages/esm-ward-app/dist/1644.js 1.85 kB 0 B
packages/esm-ward-app/dist/1677.js 4.07 kB 0 B
packages/esm-ward-app/dist/1901.js 1.85 kB 0 B
packages/esm-ward-app/dist/1925.js 88.8 kB -2.1 kB (-2.32%)
packages/esm-ward-app/dist/2016.js 1.85 kB 0 B
packages/esm-ward-app/dist/2126.js 9.84 kB +143 B (+1.47%)
packages/esm-ward-app/dist/236.js 1.85 kB 0 B
packages/esm-ward-app/dist/2757.js 2.11 kB 0 B
packages/esm-ward-app/dist/2784.js 2.62 kB 0 B
packages/esm-ward-app/dist/2969.js 203 B 0 B
packages/esm-ward-app/dist/3372.js 2.56 kB 0 B
packages/esm-ward-app/dist/3574.js 1.85 kB 0 B
packages/esm-ward-app/dist/3649.js 0 B -2.5 kB (removed) 🏆
packages/esm-ward-app/dist/3652.js 1.85 kB 0 B
packages/esm-ward-app/dist/3922.js 9.16 kB +140 B (+1.55%)
packages/esm-ward-app/dist/4124.js 3.21 kB 0 B
packages/esm-ward-app/dist/4192.js 6.09 kB 0 B
packages/esm-ward-app/dist/4272.js 1.85 kB 0 B
packages/esm-ward-app/dist/4378.js 1.85 kB 0 B
packages/esm-ward-app/dist/443.js 6.97 kB 0 B
packages/esm-ward-app/dist/4460.js 1.85 kB 0 B
packages/esm-ward-app/dist/460.js 7.41 kB +2.41 kB (+48.19%) 🚨
packages/esm-ward-app/dist/4659.js 13.5 kB +2.4 kB (+21.52%) 🚨
packages/esm-ward-app/dist/4705.js 1.85 kB 0 B
packages/esm-ward-app/dist/471.js 0 B -7.26 kB (removed) 🏆
packages/esm-ward-app/dist/5146.js 3.92 kB +1.78 kB (+83.37%) 🆘
packages/esm-ward-app/dist/5204.js 37.8 kB +1.83 kB (+5.09%) 🔍
packages/esm-ward-app/dist/5240.js 1.85 kB 0 B
packages/esm-ward-app/dist/5336.js 1.85 kB 0 B
packages/esm-ward-app/dist/5348.js 348 B 0 B
packages/esm-ward-app/dist/5362.js 1.92 kB +1.44 kB (+303.15%) 🆘
packages/esm-ward-app/dist/539.js 1.85 kB 0 B
packages/esm-ward-app/dist/5481.js 1.25 kB 0 B
packages/esm-ward-app/dist/5673.js 1.85 kB 0 B
packages/esm-ward-app/dist/5711.js 1.85 kB 0 B
packages/esm-ward-app/dist/5737.js 1.85 kB 0 B
packages/esm-ward-app/dist/5833.js 1.85 kB 0 B
packages/esm-ward-app/dist/5897.js 359 B 0 B
packages/esm-ward-app/dist/5962.js 1.85 kB 0 B
packages/esm-ward-app/dist/6053.js 12.4 kB +145 B (+1.18%)
packages/esm-ward-app/dist/6125.js 5.87 kB -4 B (-0.07%)
packages/esm-ward-app/dist/6497.js 1.85 kB 0 B
packages/esm-ward-app/dist/6566.js 1.85 kB 0 B
packages/esm-ward-app/dist/6591.js 16.8 kB 0 B
packages/esm-ward-app/dist/6717.js 1.85 kB 0 B
packages/esm-ward-app/dist/6727.js 1.85 kB 0 B
packages/esm-ward-app/dist/7019.js 3.89 kB 0 B
packages/esm-ward-app/dist/7109.js 348 B 0 B
packages/esm-ward-app/dist/744.js 1.85 kB 0 B
packages/esm-ward-app/dist/7640.js 2.42 kB 0 B
packages/esm-ward-app/dist/767.js 648 B 0 B
packages/esm-ward-app/dist/7807.js 1.85 kB 0 B
packages/esm-ward-app/dist/8015.js 480 B 0 B
packages/esm-ward-app/dist/8271.js 1.85 kB 0 B
packages/esm-ward-app/dist/8319.js 1.85 kB 0 B
packages/esm-ward-app/dist/8323.js 1.85 kB 0 B
packages/esm-ward-app/dist/8577.js 17.7 kB -4 B (-0.02%)
packages/esm-ward-app/dist/8768.js 17.4 kB +2.34 kB (+15.54%) ⚠️
packages/esm-ward-app/dist/8788.js 1.85 kB 0 B
packages/esm-ward-app/dist/899.js 1.85 kB 0 B
packages/esm-ward-app/dist/9261.js 1.85 kB 0 B
packages/esm-ward-app/dist/940.js 23.4 kB 0 B
packages/esm-ward-app/dist/9405.js 3.45 kB +1.85 kB (+115.49%) 🆘
packages/esm-ward-app/dist/9559.js 341 B 0 B
packages/esm-ward-app/dist/9579.js 1.85 kB 0 B
packages/esm-ward-app/dist/openmrs-esm-ward-app.js 3.46 kB +2 B (+0.06%)

compressed-size-action

@gracepotma
Copy link
Contributor

Note from Dennis: Seems this and this will shave off 1.99 MB from esm-pt-management (package size has been an expressed community concern from some orgs). But, he and Ian want to unpack further whether this will have any unintended consequences for implementers.

Copy link
Member

@samuelmale samuelmale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thanks @denniskigen!

@denniskigen
Copy link
Member Author

Thanks, @samuelmale. Please don't merge this yet. Keen to discuss the potential tradeoffs some more. Also keen to develop a clear rubric that we can document about where the sweet spot is for this potential performance optimization.

@samuelmale
Copy link
Member

samuelmale commented Jan 28, 2025

What are the bundle size and performance implications of not lazy-loading the root component(s)? (I understand that some root components heavily ref Carbon components)

@chibongho
Copy link
Contributor

Are there prior discussions about performance that might provide context to what / how to optimize? Reducing the bundle size is good, but don't we aggressively cache the JS files in the browser anyway? If I understand correctly, this should improve the load time when we first time we load O3 after a deploy, but the performance impact would not be that significant for subsequent loads.

@ibacher
Copy link
Member

ibacher commented Jan 29, 2025

What are the bundle size and performance implications of not lazy-loading the root component(s)?

It's hard to know in detail. This is a balancing act, not an exact science. The microfrontend architecture and especially the extension system make ensuring that quite challenging, so a lot of this is going to be trial-and-error.

High-level, we'd want to get to a place where:

  • We're limited to as close to, say, no more than 20 blocking requests to load a single "page"
  • Over a "good" connection the app can load < 1 second and over a laggy connection it takes no more than 30 seconds
  • With all JS and openmrs.css cached, most pages load < 300kB of data and all pages load < 1 MB of data

How we get there, though, is what we need to experiment with. Essentially, adding code splits trade a network request for a smaller volume of data-over-the-wire in each case, but it can go wrong in two ways:

Chunks that are too small

Currently, the leading edge of this is the translations for the home page app, which has only a single translation key, home. What gets sent over the wire is this:

"use strict";(globalThis.webpackChunk_openmrs_esm_home_app=globalThis.webpackChunk_openmrs_esm_home_app||[]).push([[300],{4300:e=>{e.exports={home:"Home"}}}]);

Which is 160 bytes of data to load 13 bytes of "usable" data (the JS object {home:"Home"}. Worse still because the headers with the CSP take up 622 bytes, we actually send 782 bytes over the wire for 13 usable bytes. This is a little bit silly and I don't think it's a real problem, but we don't want to end up in a state where we have too many such cases.

Chunks that are too large

On the flip side of things, we also end up with chunks that are probably larger than they should be. Currently on dev3, the largest JS file is a chunk from the billing app consisting of this:

Billing App

However, it compresses pretty well (a lot of that is embedded CSS, which likely has a large amount of repetition, so it compresses very well), so the most space consuming thing sent is currently this:

ESM Core

Which is Carbon packaged as a peer dependency (although if we start using Carbon as a peer dependency everywhere, this chunk only needs to be loaded once and we can replace all the places that Carbon gets embedded in the app, so maybe we do want this).

Even these "large" chunks aren't huge, under 300 kB when gzipped, but they can often point to places where code has either been split inefficiently (e.g., why are all the SCSS files for the whole billing app in a single chunk instead of paired with the code for each extension?) or where there may be unnecessary duplication of libraries (which is what #1468 was ultimately about).

But I don't have any really rote approach to how we determine these, we just need to keep looking at:

  • The number of files being requested
  • The size of those files
  • The load time over those files with a "slow" connection

Because, ultimately, the goal here—more than any hard numbers—is that it the app feels responsive to users.

To be clear, I don't mean the above examples to be cases of things we should get away with. It probably makes sense to load translations the way we currently do because while the 782 bytes to 13 useful bytes ratio sounds atrocious, it also means we can use a single loading pathway that supports both the home app and an app with 120 different translation keys. Similarly, the Carbon chunk is huge relative to the app, but if we only load it a single time, it will likely reduce the overall amount of data transferred and, since it's loaded fairly early, doing so might actually make the app "feel" more responsive (since we paid the loading cost before the login page fully rendered).

Are there prior discussions about performance that might provide context to what / how to optimize?

Yes, but they are mostly captured in PRs like this. I think we've synthesized some of them into the developer docs though, where we can.

Reducing the bundle size is good, but don't we aggressively cache the JS files in the browser anyway?

Yeah, but we run into the reality that many long-term users of OpenMRS-based systems have been taught to empty the cache an reload pages when things in the EMR don't work. And, in any case, as we see larger facilities deploy OpenMRS and more cloud-based deployments, any bandwidth use we can shave helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants