Comments (13)
We're down to 56Mb now, so I think this can be closed. We could spend endless time to optimize more but I don't think it will give us that much more bang for the buck.
https://github.com/deltachat/deltachat-desktop/releases/tag/v1.2.2
from deltachat-desktop.
Here’s a PR on another project that reduces build size using electron-builder without two package json (look at package.json) https://github.com/cabal-club/cabal-desktop/pull/85/files
from deltachat-desktop.
I suspect this is due to node_modules/
containing development modules. We might want to split up the app using the Two package.json structure. Simply put, move everything related to the app into an app
folder and keep all development related dependencies in the root package.json.
from deltachat-desktop.
@Karissa Do you think the two package.json structure is the way to go? I could take a stab at this.
from deltachat-desktop.
I have never tried that — it seems like it should be unecessary to do that perhaps it’s the easiest to implement. I hear people complain about the two package json structure and there could be another way..
from deltachat-desktop.
If I understand this correctly you need to use yarn
? https://yarnpkg.com/lang/en/docs/selective-version-resolutions/
I hear people complain about the two package json structure
What are they complaining about?
from deltachat-desktop.
I spent some time investigating what's causing this size. Below are my findings:
Prepare
Skip generating .deb
file to increase speed of test. Also it's not relevant to the test.
I did a quick check on the folders and they are fairly small:
$ du -sh src/ es5/ build/ bin/ images/ _locales/ static/
144K src/
164K es5/
64K build/
16K bin/
300K images/
212K _locales/
2,0M static/
It must be the node_modules/
folder that's causing the big size.
test command
I used the following command for testing size.
rm -rf node_modules/ && npm i && rm -rf dist/ && npm run dist; ls -al dist/*.AppImage
The last ;
is because npm run dist
fails due to missing github credentials.
devDependencies
First lets try if it's a problem with devDependencies
being included.
- size of .AppImage file: 214518973 bytes
- remove
standard
-> 214518649 bytes (-324 bytes) - remove
nodemon
-> 214518789 bytes (+140 bytes) - remove
babel-eslint
-> 214519372 bytes (+583 bytes) - remove
buble
(install globally instead) -> 214518986 bytes (-386 bytes) - remove
depcheck
(not used) -> 214518885 bytes (+/- whatever bytes)
I think it's fairly clear that devDependencies
isn't affecting the resulting image at all, since removing some dependencies adds size to the resulting binary. Also, this is in the magnitude of hundreds of bytes, which is uninteresting. Apparently electron-builder
handles this in a good way.
Lets move on to dependencies.
dependencies
Lets also revert all devDependencies and start from scratch.
- size of .AppImage file: 214518973
- remove
deltachat-node
-> 200066198 (-14452725), apparently has a bit of effect but "only" 14Mb, there must be something else taking up more space (we might be able to reduce this size as well) - remove
react
-> 200065813 (-385), i.e. 0 effect - remove
react-dom
-> 200066045 (+232), i.e. 0 effect - remove
react-intl
-> 198946736 (-1119309), 1Mb so not a lot - remove
run-parallel
-> 198942483 (-4253), hardly noticable effect - remove
lodash.merge
-> 198938535 (-3948), hardly noticable effect - remove
intl-tel-input
-> 198491122 (-447413), ~450k so not a lot - remove
insert-css
-> 198491286 (+164), i.e. 0 effect - remove
emoji-panel
-> 165022652 (-33468634), ~32Mb so quite a bit, but still a lot to go (this should/could be optimized) - remove
debounce
-> 165017952 (-4700), hardly noticable effect - remove
conversations
-> (errors due to missingreact
andreact-dom
so putting them back) -> 54294609, so roughly 110Mb effect (highest prio) - remove
application-config
-> 54290421 (-4188), hardly noticable effect - remove
@blueprint/core
-> 51215169 (-3075252), ~3Mb so not a lot - remove
arch
-> 51211202 (-3967), hardly noticable effect
conclusion
We should look further into optimizing the following dependencies and see what's causing this. And in this order.
conversations
(110Mb)emoji-panel
(32Mb)deltachat-node
(14Mb)
from deltachat-desktop.
@Karissa Side note: I went through the cabal-desktop
process and it's not really different from ours, since I only used npm to build the cabal desktop app and still produces a good sized binary, which lead me to this dependency quest to get more information.
from deltachat-desktop.
Jumped into conversations
a bit.
$ npm i --production
$ du -sh node_modules/
121M node_modules/
Used Disk Usage Analyzer
:
It seems the emoji-datasource
module is the culprit here.
Checking conversations
where this is used:
$ git grep -n -C3 emoji-datasource`
So, it seems conversations
isn't using emoji-datasource
directly. How about indirectly? (ag
is the_silver_searcher
)
$ ag -a emoji-datasource
There seems to be no usage of emoji-datasource
whatsover. But conversations
depend on emoji-js
. So somewhere around here we should make a decision. Maybe fork emoji-js
and just remove all that crap? :)
It's basically just a bunch of .png
files:
$ ls -al node_modules/emoji-datasource/
total 108992
drwxr-xr-x 2 lms lms 4096 sep 29 17:59 .
drwxr-xr-x 24 lms lms 4096 sep 29 17:59 ..
-rw-r--r-- 1 lms lms 3445 nov 17 2017 CHANGES.md
-rw-r--r-- 1 lms lms 983922 nov 17 2017 emoji.json
-rw-r--r-- 1 lms lms 1629054 nov 17 2017 emoji_pretty.json
-rw-r--r-- 1 lms lms 1080 apr 6 2017 LICENSE
-rw-r--r-- 1 lms lms 2042 sep 29 17:59 package.json
-rw-r--r-- 1 lms lms 4832 nov 17 2017 README.md
-rw-r--r-- 1 lms lms 1611272 nov 17 2017 sheet_apple_16.png
-rw-r--r-- 1 lms lms 2287847 nov 17 2017 sheet_apple_20.png
-rw-r--r-- 1 lms lms 4774502 nov 17 2017 sheet_apple_32.png
-rw-r--r-- 1 lms lms 13693323 nov 17 2017 sheet_apple_64.png
-rw-r--r-- 1 lms lms 1460924 nov 17 2017 sheet_emojione_16.png
-rw-r--r-- 1 lms lms 2038219 nov 17 2017 sheet_emojione_20.png
-rw-r--r-- 1 lms lms 4025880 nov 17 2017 sheet_emojione_32.png
-rw-r--r-- 1 lms lms 8962564 nov 17 2017 sheet_emojione_64.png
-rw-r--r-- 1 lms lms 1500486 nov 17 2017 sheet_facebook_16.png
-rw-r--r-- 1 lms lms 2086626 nov 17 2017 sheet_facebook_20.png
-rw-r--r-- 1 lms lms 4169966 nov 17 2017 sheet_facebook_32.png
-rw-r--r-- 1 lms lms 10785774 nov 17 2017 sheet_facebook_64.png
-rw-r--r-- 1 lms lms 1454327 nov 17 2017 sheet_google_16.png
-rw-r--r-- 1 lms lms 2008386 nov 17 2017 sheet_google_20.png
-rw-r--r-- 1 lms lms 3843575 nov 17 2017 sheet_google_32.png
-rw-r--r-- 1 lms lms 9462647 nov 17 2017 sheet_google_64.png
-rw-r--r-- 1 lms lms 1559060 nov 17 2017 sheet_messenger_16.png
-rw-r--r-- 1 lms lms 2196115 nov 17 2017 sheet_messenger_20.png
-rw-r--r-- 1 lms lms 4503752 nov 17 2017 sheet_messenger_32.png
-rw-r--r-- 1 lms lms 12502765 nov 17 2017 sheet_messenger_64.png
-rw-r--r-- 1 lms lms 1274797 nov 17 2017 sheet_twitter_16.png
-rw-r--r-- 1 lms lms 1733472 nov 17 2017 sheet_twitter_20.png
-rw-r--r-- 1 lms lms 3268949 nov 17 2017 sheet_twitter_32.png
-rw-r--r-- 1 lms lms 7693547 nov 17 2017 sheet_twitter_64.png
from deltachat-desktop.
from deltachat-desktop.
@hpk42 We can go much lower than that if we tweak these dependencies a bit. Around 50-60Mb should be doable.
from deltachat-desktop.
great!
from deltachat-desktop.
very cool :)
from deltachat-desktop.
Related Issues (20)
- Refactor to remove possible races when switching account in message list / chatstore HOT 2
- windows: add-second-device issues HOT 1
- Flickering issue when hovering over account switch avatar HOT 1
- do not enable experimental feature by default HOT 10
- "Tap to learn more" doesn't do anything on error messages from sending from another device
- chat titles are selectable, but selection results in unusual behaviour HOT 3
- shadow missing for mute icons on accounts in sidebar HOT 1
- buttons became a little clumsy and less distinctive
- "show full message" html-view broken HOT 4
- Editting name of a contact does not change their name in the messages HOT 1
- Popup with reaction details only shows one reaction per contact HOT 4
- Cramped layout at lower resolutions HOT 1
- "Open" instead of "Save" in directory selector HOT 10
- Release Progress `v1.44.0` 💫 HOT 2
- cancel which configuration/login progress bar shows screen as if you were logged in
- DC-Desktop 1.44 for macOS, Linux and Windows does not start HOT 6
- Release Progress `v1.44.1` 💫
- Message draft discarded when switching to different chat quickly
- with Multi-account desktop sidebar, black screen on the pinephone HOT 9
- Green dot never disappears HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deltachat-desktop.