-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[Performance] Reduce Desktop size #6927
Comments
Triggered auto assignment to @marcaaron ( |
This article seems helpful https://medium.com/gowombat/how-to-reduce-the-size-of-an-electron-app-installer-a2bc88a37732 |
I don't think we should go the chrome route. Either we make the app smaller or we don't, making the installer seem small is not worth it IMO. |
Thanks for the investigation! Just my opinion, but doesn't seem super high priority considering contributors and Expensify staff are the main users of the desktop app at the moment and large installer sizes are not likely to inhibit anyone motivated to install and use the app. I would recommend we wait until there are more usage statistics to address the problem of a large installer. Just my 2 cents though - will leave this open and let others share their thoughts. |
Triggered auto assignment to @mallenexpensify ( |
@kidroca are you fine with me assigning this to you as a monthly? I can add the planning label too. There isn't an immediate need to decrease the file size but it's something we should be aware of and consider addressing. We might be able to make incremental improvements over time too, which is why I'd like to leave this issue open. |
Yes, I'd like that |
Chrome's 1MB is not exactly a trick to make the app small, but actually to download only what's necessary We have 2 architectures on mac now - x86 (Intel) and arm64 (M1) supporting both with 1 installer means 2x the size One installer for all archs (current):
Installer per arch:
Installer downloads on the fly:
Let's investigate the possibilities
(1) Would probably be the simplest. We'd need to auto detect the user architecture and offer them the correct package to download. And/or let them pick manually Investigate what would it take to implement (2) |
Oh, good points. I assume that 2 needs 1, no? ie: we need the per arch installers that the "main" installer downloads, right? |
Thanks @kidroca, issue labels/assignment updated! |
Found something interesting
Before
After moving
|
It turned out we only build for a single arch already - the build command will use the current architecture An easy change to reduce app size by half would be to move our dependencies to https://jsramblings.com/do-dependencies-devdependencies-matter-when-using-webpack/
App being an end product (e.g. not a library) has not much use for declaring Another approach might be to come up with an ignore pattern(s), like The electron app actually starts here, and these packages do need to be included in the Lines 9 to 13 in 0bce091
|
@marcaaron @iwiznia can you review the above? (not time sensitive). Cutting the file size in half would be a big improvement. |
I am a bit confused... how do we know which dependencies are used during build and which are used during run? Seems to me that there's a ton of dependencies that are used during run besides the ones being required in main.js, no? |
Non of the
Excluding the stuff in main, everything else is used only during build time
For example on web we host an index.html that includes a script tag with the bundled js. We're not copying the node modules along with that Pretty much everything in a front end project is a build time dependency - whatever is needed during runtime is bundled in |
Great, idea.
|
Found another improvement - we're double adding the compiled This config rule adds the Lines 25 to 26 in b93c6d3
But by default Let's see what's actually packed in App: Let's see what's inside this `app.asar` archiveThis is evidence of the Electron using the output folder (dist) for a temporary build which we unintentionally add to the package and this is worth another 180MB End result of fixing this is the installer becomes 88MB
I've provided a link - you can see for yourself that the app is working same as before but it's 4x less size It's easy to fix this by specifying an output directory for Electron diff --git a/config/electron.config.js b/config/electron.config.js
--- a/config/electron.config.js (revision d59aa4f750ba847843aee64d4c5a2bbf4ded3528)
+++ b/config/electron.config.js (date 1643385656801)
@@ -27,4 +28,7 @@
'./desktop/*.js',
'./src/libs/checkForUpdates.js',
],
+ directories: {
+ output: 'desktop-build',
+ },
}; |
Nice! Thanks for the explanations!! |
@iwiznia It might be a good idea to update documentation so that we don't make the same mistake when new packages are installed |
Posted a thread on slack: https://expensify.slack.com/archives/C01GTK53T8Q/p1643645168448979 We decided to go in another direction and create a 2nd |
Pull Request is ready for review: #7744 |
There's another way to make the Desktop app much smaller By making web comply with Progressive Web App (PWA) standards, Chrome would allow you to install the website as a Desktop App: https://caniuse.com/web-app-manifest By default the app is kept up to date the same way a website is - when you launch/refresh you see the updated version Expensify.PWA.mp4Installing and removing the appExpensify.PWA.installing.mp4About 200 line changes were necessary to achieve what's presented in the video
|
@kidroca, this Monthly task hasn't been acted upon in 6 weeks; closing. If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead. |
@kidroca you were able to reduce the desktop size some, right? Can you provide a quick update for auditing purposes (or... let me know if you think it should be reopened) |
@mallenexpensify Summary
|
@kidroca were we able to reduce the size at all? Are the After #s where we're currently at or where we could be? |
Sorry for the confusion. The size is considerably reduced - "after" is the result of this ticket and the current size of the desktop app |
What I'm demoing here is removing the desktop app entirely and make the web app inatallable as PWA (Progressive web app): #6927 (comment) The experience is very similar to what we have with the electron desktop app, but without the need to download the app (and maintain desktop specific code) But it has some caveats |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
What performance issue do we need to solve?
What is the impact of this on end-users?
List any benchmarks that show the severity of the issue
Proposed solution (if any)
Research ways to reduce the installer size
For example Chrome's installer is so small because it downloads more data as part of the installation process
Research Electron documentation on ways to reduce size
List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)
Note: These should be the same as the benchmarks collected before any changes.
Platform:
Where is this issue occurring?
Version Number: 1.1.24-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
#expensify-open-source: https://expensify.slack.com/archives/C01GTK53T8Q/p1640642055143300
View all open jobs on Upwork
The text was updated successfully, but these errors were encountered: