bytecodealliance / javy

JS to WebAssembly toolchain
Apache License 2.0
2.24k stars 108 forks source link

Feature Request: Ability to Change Brotli Compression Level via CLI #579

Closed orisano closed 10 months ago

orisano commented 10 months ago

What is the idea?

I would like to propose a feature for Javy that allows users to adjust the Brotli (br) compression level through the command-line interface (CLI).

What problem does it solve?

Current Behavior

Currently, Javy is configured to compress with Brotli at a fixed maximum level of 11.

Proposed Feature

I suggest implementing a functionality that enables users to specify the Brotli compression level via CLI arguments. This would offer more flexibility, especially for different use cases where maximum compression is not always necessary.

Background and Justification

In my specific use case, I am dealing with JavaScript files of size 8.5MB. The compression process is currently consuming about 80% of the total processing time. Since I'm using Javy for WebAssembly (wasm) plugin development, the highest level of compression is not always required during development phases.

Additionally, Brotli compression, in its current implementation, is a single-core process, which does not benefit from multi-core machines. This aspect further contributes to the lengthy processing times.

Alternative Considerations

Another potential solution could be exploring different compression formats like zstd, which might offer better performance or efficiency for certain scenarios.

I believe this feature would greatly enhance Javy's usability and efficiency, particularly for those working in development environments where time and resources are critical factors.

Thank you for considering this request.

jeffcharles commented 10 months ago

Based on your use case, I think the better approach might be having a CLI flag to disable compression entirely. It's just used for populating a custom section with a copy of the JS source code which isn't necessary for running the Wasm module. It's just there so you can know what JS was used to create the module in case you're interested for whatever reason.

Could possibly even have a --dev CLI flag since it sounds like outcome you want is to prioritize faster compile times over minimizing the size of the Wasm module.

orisano commented 10 months ago

Thanks for the reply. My motivation is to reduce compile time, so I think --dev will achieve that.

jeffcharles commented 9 months ago

We've released a new version of Javy that includes this CLI flag