-
Notifications
You must be signed in to change notification settings - Fork 23
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
Research: How to "Reduce unused JavaScript
" in Flutter
Web App?
#326
Comments
At the time of writing, there is no question on
|
With the addition of: Line 38 in f6a0eff
We now have a rudimentary "bot detector": That means
|
I tried to get Lines 16 to 23 in f6a0eff
Which I was attempting to run in the app/.github/workflows/deploy.yml Lines 35 to 53 in f6a0eff
It works on But the filesystem is not writeable on So it doesn't work on If anyone |
We are using flutter web in our own app too. We patched flutter generated output to download resources in parallel. See it here. flutter/flutter#76009 (comment) |
@harryfei thanks very much for sharing. 🙏 |
Hm I've created the
Checking flutter/flutter#104830... |
Yep, running |
enkra-send's flutter speedup patch always preload canvaskit.js and cavaskit.wasm https://github.com/enkra/enkra-send/blob/a2ecf6b8f41e8ca35e8ceb62fb1a63fc3bf25c28/build_tools/web/flutter.js.patch#L10-L11 You can delete those lines if you build with |
Yeah, I figured you were using the Thank you very much ❤️ @harryfei |
…es/flutter-web-speed-boost/README.md dwyl/app#326
@LuchoTurtle has documented the patch suggested by @harryfei in: |
With the recent deployment to
GitHub Pages
: #322 (comment)the
performance
score is now70
: https://pagespeed.web.dev/report?url=https%3A%2F%2Fapp.dwyl.com 🎉while
much better than the32
we were seeing last week and definitely something to celebrate! 🥳it's still unacceptably low. 🐌
It must be possible to achieve
100
even if we need to resort to "smoke and mirrors". 🤔i.e: we create a "mockup" of the
App
in PureHTML
andCSS
and replace the basicloading
screenwith a "Useful tips" page and deliberately delay downloading any
JS
usingSetTimeout
⌛So the page is fully interactive and
PageSpeed Insights
can turn a blind eye to theJS
. 🙈see: #325
Reduce unused
JavaScript
The main recommendation
PageSpeed Insights
offers is "Reduce unusedJavaScript
" ...As noted in: #315 (comment) the
main.dart.js
file is massive!!https://github.com/dwyl/app/blob/af4e656aa5d84102f969b9ce3b336affda521ba2/main.dart.js
The
flutter.js
file doesn't appear to be the problem:app/index.html
Line 26 in af4e656
It's not a very big file, only
376 loc
and13.6kb
: https://github.com/dwyl/app/blob/af4e656aa5d84102f969b9ce3b336affda521ba2/flutter.jsTodo
JS
(main.dart.js
being the biggest file!)e.g: can we split out the engine and our application code / business logic into separate files for parallel downloading?
main.dart.js
, we're definitely not using them all! See: main.dart.js is too large flutter/flutter#46589Starting point:
(no ChatGPT summaries please... 😜 )
https://www.reddit.com/r/FlutterDev/comments/ve81cw/strategies_to_overcome_flutter_web_loading_time/
App
is small this might not have a very big impact. But as it grows this might become essential for reducing theAPK
size and ensuring fast load times.Again, this may not impact the
Web App
... it may only be theAndroid
version, but could still be worth exploring. 🔍Wait for
Wasm
? ⏳ 🤷♂️We could just focus on building features and wait patiently for
Flutter
to be compiled toWebAssembly
which will eliminate the
JS
(or at least drastically reduce it ...) 💭This might be a
while
... see: flutter/flutter#41062 and flutter/flutter#53041 (comment)I'm not holding my breath that
Flutter Web
will be compiled toWasm
in 2023 ... ⏳ 🤷♀️And we need to ship our
Flutter Web App
and get to 1kpeople
ASAP.Sponsor/Bounty a
Flutter
Expert? 💰Given that we hypothesize that initial
Web App
loading timewill be one of the biggest reasons for
people
to "bounce" from thedwyl web app
,we could figure out how to setup a "bounty" to get a
Flutter
expert to help us with this.priority-2
? 🔥 🤷♂️while
we would love to dedicate all of our resources to fixing this immediately. 🙏We have done a decent amount of googling and nothing obvious jumps out. 🔍 🤷♂️
We cannot allocate an
undefined
amount of time into this at the expense of building features. 👎We're assigning
priority-2
to this because: 2️⃣a) this not a feature that
people
trying theApp
are going to say "wow" I need thisApp
in my life! 😍b) it's an "unknown unknown" i.e. we have no idea (up-front) how long this will take to fix. 🤷♂️
c) there could be a "rug pull" in the form of: 💭
Dart v3
compilation toWasm
: https://medium.com/dartlang/dart-3-alpha-f1458fb9d232 🤞Flutter
eventually releases a new version that dramatically improvesWeb
compilation. 🚀So ... this is something we need to keep chipping away at 🧑💻
and leaving comments on this issue with everything that we try along the way. 💬
The text was updated successfully, but these errors were encountered: