bun build --compile my-script.js
deno compile my-script.js
Setup: I created a project for a simple command-line utility for reading
package.json files from the terminal:
github.com/seanmcp/rpj. Then I implemented the
utility in all three environments: Bun, Deno, and Go. I have Bash scripts to
create the executables and then compare the results by two metrics: file size
and execution time.
- Bun: 97733752 bytes or 97.7 megabytes
- Deno: 109968928 bytes or 110.0 megabytes
- Go: 2607443 bytes or 2.6 megabytes
Go created the smallest executable (by a wide margin). I ran into issues with the Deno executable being rejected by GitHub for being too large, and Bun isn’t far behind.
- Bun: 0:00.04 real, 0.02 user, 0.01 sys
- Deno: 0:00.04 real, 0.02 user, 0.01 sys
- Go: 0:00.00 real, 0.00 user, 0.00 sys
Afterward: Node.js does have an experimental feature to create executables, but at the time of writing the steps were too involved. For open-source options for creating Node executables, checkout nexe and pkg.