Skip to content
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

Executable size is big - idea(s) for reducing size. #42

Open
junh1024 opened this issue Mar 3, 2022 · 6 comments
Open

Executable size is big - idea(s) for reducing size. #42

junh1024 opened this issue Mar 3, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@junh1024
Copy link

junh1024 commented Mar 3, 2022

Hi.

The extracted exe is about 75mb, which is big.

I tried using UPX directly to compress the exe, but it does not work for d-fi "Pkg: Error reading from file.", and the issues is unlikely to be fixed soon on the upx side.

Maybe you can compress the exe while compiling it with pkgx ? As a complete node & typescript rookie, I was unable to get it working in a few minutes.

Maybe you can get pkgx working to compress the exe during the compile stage.

@nkeor
Copy link

nkeor commented Mar 3, 2022

From https://github.com/irelance/node-pkgx/:

wine is need for linux or mac, since ResourceHacker only support pe

Not happening anytime soon...

The reason for such a big size is that the binary has to include a node runtime.

@junh1024
Copy link
Author

junh1024 commented Mar 5, 2022

Yes I know it needs a runtime. When you build, with pkg, do you compress it?

  – reduce size of the data packed inside the executable with GZip
    $ pkg --compress GZip index.js

via

@nkeor
Copy link

nkeor commented Mar 23, 2022

Compression is not enabled right now, but unfortunately the binary includes a node runtime which isn't very compressable. The gains might be minimal. Anyways, I might enable it in a future release after some testing.

@sayem314
Copy link
Member

caxa seems like a good candidate for packaging. It also supports ESM modules.

@nkeor
Copy link

nkeor commented Mar 23, 2022

Excelent, I'll look into it

@sayem314 sayem314 added the enhancement New feature or request label Mar 25, 2022
@nkeor
Copy link

nkeor commented Apr 2, 2022

Well, caxa doesn't seem like such a good fit anymore:

$  yarn caxa -- --input . --output d-fi_caxa -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/dist/src/d-fi.js"
$ ls -lh d-fi_caxa
-rwxr-xr-x 1 namkhai namkhai 126M Apr  2 13:12 d-fi_caxa
$ ls -lh build/d-fi
-rwxr-xr-x 1 namkhai namkhai 46M Mar 30 11:59 build/d-fi

Other issues are

  • needs /tmp/ mounted with exec
  • fails to build with tmpfs' default inode count (runs out of inodes)

Using --compression GZip on pkg saves 3MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants