Open steffenkleinle opened 9 months ago
Maybe check out https://web.dev/learn/performance
This adresses bundle size and code compression:
It seams tree shaking does not work for lodash. The bundle still contains unused components.
When switching to function imports this is fixed e.g. from import { isEqual } from 'lodash'
to import isEqual from 'lodash'
. Compare with the bundle analyzer.
Sadly, i18next and luxon don't support tree-shaking.
We could also add "sideEffects": false
to the translation
, shared
and build-configs
project. This allows webpack to remove unused code from thes projects. https://webpack.js.org/configuration/optimization/#optimizationsideeffects
All over these changes could reduce the bundle size from around 791kb gzipped to 777kb gzipped.
Hmm, doesn't sound like a lot (< 2%) but I guess it still makes sense to do what we can. No other optimization potential here?
Steps to get the same report:
yarn run webpack-dev-server-ts --env config_name=integreat-test-cms
[!Warning] Page Speed Insights might use slightly different throttling, resulting in slightly different results
To reproduce the same results: 1.. Create a new hardwareprofile in the network tap using these settings:
Things that might have a performance impact:
sideEffects: false
to all of our projects. https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-freereact
and react-dom
into separate chunks or just by setting the chunk max size. I think this block article is a good starting point what can be achived here -> https://medium.com/@addyosmani/progressive-web-apps-with-react-js-part-2-page-load-performance-33b932d97cf2@sarahsporck Thanks for documenting your results here. :+1:
For reducing the main thread work, we have a separate ticket here: https://github.com/digitalfabrik/integreat-app/issues/2498
Is your feature request related to a problem? Please describe. Google still thinks our mobile performance is too slow, i.e. we have a LCP longer than 2.5 on most sites on mobile. Therefore we should try to speed up our web app more.
Describe the solution you'd like Investigate whether we can reduce javascript execution time: https://developer.chrome.com/docs/lighthouse/performance/bootup-time/?utm_source=lighthouse&utm_medium=lr#how-to-speed-up-javascript-execution
Describe alternatives you've considered None.
Additional context LCP: https://search.google.com/search-console/core-web-vitals/drilldown?resource_id=https%3A%2F%2Fintegreat.app%2F&item_key=CAMQAhgC
Part of #2371 , relates to #2498.