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

Combine .wasm and .js files [3 XMR] #248

Closed
woodser opened this issue Sep 1, 2024 · 4 comments · Fixed by #250
Closed

Combine .wasm and .js files [3 XMR] #248

woodser opened this issue Sep 1, 2024 · 4 comments · Fixed by #250
Labels
💰bounty There is a bounty on this issue

Comments

@woodser
Copy link
Owner

woodser commented Sep 1, 2024

This issue requests combining the .wasm and .js files, as requested in #83.

#247 succeeds to combine the .wasm and .js files within dist and is tested to work in the browser.

However, monero_web_worker.js swells to 10.4 mbs, and monero_web_worker.js.map is 14.5 mbs. Ideally, the web worker can remain at or below 1.5 mbs and the source map at 5.5 mbs.

If the file sizes increase too much, it may not be worth it.

In addition, the project should be configured to use the combined .js files "as is", without manually copying them to the public folder for web apps.

@woodser woodser added the 💰bounty There is a bounty on this issue label Sep 1, 2024
Copy link

github-actions bot commented Sep 1, 2024

There is a bounty on this issue. The amount is in the title. The reward will be awarded to the first person or group of people who resolve this issue.

If you are starting to work on this bounty, please write a comment so that we can assign the issue to you. We expect contributors to provide a PR in a reasonable timeframe or, in case of an extensive work, updates on their progress. We will unassign the issue if we feel the assignee is not responsive or has abandoned the task.

Read the full conditions and details of the bounty system.

@mainnet-pat
Copy link
Contributor

mainnet-pat commented Sep 2, 2024

Comparing bytesize (see below) of dist compressed and uncompressed artifacts it is clear that compression brings a lot of benefit. Modern webservers do compress the static assets and moder browsers can handle the compressed assets. So the bandwidth consumption will be lower as compared to raw files.

Base64 bloats any binary by a max factor of ceil(n / 3) * 4. But it is itself compressible. Modern libs such as pako take 21kb in space. So maybe a custom solution of compressing b64 wasm data and inflating it before instantiating the worker could be meaningful.

 355534 dist/monero_wallet_full.js
  41542 dist/monero_wallet_full.js.zip
5308255 dist/monero_wallet_full.wasm
1493022 dist/monero_wallet_full.wasm.zip
 113943 dist/monero_wallet_keys.js
  29371 dist/monero_wallet_keys.js.zip
1166793 dist/monero_wallet_keys.wasm
 454443 dist/monero_wallet_keys.wasm.zip
2266447 dist/monero_web_worker.js
   7264 dist/monero_web_worker.js.LICENSE.txt
   2266 dist/monero_web_worker.js.LICENSE.txt.zip
7431614 dist/monero_web_worker.js.map
1762857 dist/monero_web_worker.js.map.zip
 589528 dist/monero_web_worker.js.zip

@mainnet-pat
Copy link
Contributor

mainnet-pat commented Sep 2, 2024

Zipped single_file=1 artifacts:

7.4M    dist/monero_wallet_full.js
2.0M    dist/monero_wallet_full.js.zip
1.6M    dist/monero_wallet_keys.js
604K    dist/monero_wallet_keys.js.zip
9.9M    dist/monero_web_worker.js
2.9M    dist/monero_web_worker.js.zip
 14M    dist/monero_web_worker.js.map
3.8M    dist/monero_web_worker.js.map.zip

@woodser woodser changed the title Combine .wasm and .js files [1 XMR] Combine .wasm and .js files [3 XMR] Sep 3, 2024
@woodser
Copy link
Owner Author

woodser commented Sep 14, 2024

Resolved with #250, which was incorporated in v0.11.0.

@woodser woodser closed this as completed Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💰bounty There is a bounty on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants