Skip to content

Instantly share code, notes, and snippets.

@ralphtheninja
Created September 29, 2018 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralphtheninja/343b3f586dab4d8da75a0027b2e4603a to your computer and use it in GitHub Desktop.
Save ralphtheninja/343b3f586dab4d8da75a0027b2e4603a to your computer and use it in GitHub 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 node_modules && npm install && rm -rf dist/ && npm run dist; ls -al dist/*.AppImage

devDependencies

First lets try if it's a problem with devDependencies being included.

  1. size of .AppImage file: 214518973 bytes
  2. remove standard -> 214518649 bytes (-324 bytes)
  3. remove nodemon -> 214518789 bytes (+140 bytes)
  4. remove babel-eslint -> 214519372 bytes (+583 bytes)
  5. remove buble (install globally instead) -> 214518986 bytes (-386 bytes)
  6. 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.

  1. size of .AppImage file: 214518973
  2. 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)
  3. remove react -> 200065813 (-385), i.e. 0 effect
  4. remove react-dom -> 200066045 (+232), i.e. 0 effect
  5. remove react-intl -> 198946736 (-1119309), 1Mb so not a lot
  6. remove run-parallel -> 198942483 (-4253), hardly noticable effect
  7. remove lodash.merge -> 198938535 (-3948), hardly noticable effect
  8. remove intl-tel-input -> 198491122 (-447413), ~450k so not a lot
  9. remove insert-css -> 198491286 (+164), i.e. 0 effect
  10. remove emoji-panel -> 165022652 (-33468634), ~32Mb so quite a bit, but still a lot to go (this should/could be optimized)
  11. remove debounce -> 165017952 (-4700), hardly noticable effect
  12. remove conversations -> (errors due to missing react and react-dom so putting them back) -> 54294609, so roughly 110Mb effect (highest prio)
  13. remove application-config -> 54290421 (-4188), hardly noticable effect
  14. remove @blueprint/core -> 51215169 (-3075252), ~3Mb so not a lot
  15. 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.

  1. conversations (110Mb)
  2. emoji-panel (32Mb)
  3. deltachat-node (14Mb)

Note that this is compressed data, so in reality it's probably a lot more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment