Comments (2)
Cool! Thanks for posting about this. It looks really well-considered.
I took a brief stab at hooking up esbuild and it worked fine on the first try (including passing the todomvc tests). Here's how to invoke it:
{
id: 'esbuild',
name: "esbuild",
variants: [
{
command: 'esbuild %%in%% --minify-whitespace --outfile=%%out%%'
},
{
id: 'minify',
command: 'esbuild %%in%% --minify --outfile=%%out%%'
}
]
},
Running the benchmark on my machine looks like this:
It's not surprising that the size of esbuild's minified output isn't completely as small as other minifiers that have been carefully tuned for years. I only did enough minification in esbuild to bring it within the same ballpark of other minifiers. Only the most significant minification transformations are implemented, and I haven't yet optimized specifically for small size under compression.
It's also not surprising that esbuild is the fastest, especially given the overhead of JIT warmup in node. Much of esbuild's performance comes from parsing multiple files in parallel, but esbuild also has fast single-threaded performance.
Some thoughts about performance/correctness tests:
-
I've noticed that running a minifier is much slower the first time. I assume this has to do with the OS loading the files from disk into some cache. When benchmarking minifiers, make sure to run the multiple times and discard the first result, or the first minifier will be unfairly penalized.
-
Even if a code base doesn't have tests, I've gotten some mileage out of just executing the code and making sure it doesn't crash on startup. Presumably this type of test only works for library code and not application code.
-
JavaScript has a great test suite called test262. It's not specifically intended for minifiers but it has a ton of coverage for various strange language feature combinations and has helped me find a ton of bugs. For example, you can minify each valid syntax test case and re-parse it with another parser to check that it's valid syntax. You could also do a whitespace-only minification and then verify that the syntax tree is the same using another parser. If you're ambitious enough you could even try running the tests although you'll need to figure out a test harness.
I do think this project would be useful for me. The more tests the better! And it's great to have a nice visualization like this. I've been manually entering numbers into a Google spreadsheet.
from esbuild.
I'm going to close this since it's a conversation and not an issue with esbuild. Please feel free to continue to discuss this here though!
from esbuild.
Related Issues (20)
- Import with wildcard HOT 2
- Inside docker, esbuild quietly exits with 0 when --serve is enabled HOT 4
- Build failing in Dockerfile but works on local Windows machine
- Broken automatic JSX transform HOT 7
- ERROR: Expected "*/" to terminate multi-line comment HOT 2
- Expected ";" but found "const" - typescript transformer HOT 2
- Option to disable injected comment of input path file HOT 2
- Additional directories to watch HOT 3
- esbuild does not fail with undefined functions HOT 5
- Segmentation fault when using with vite and sveltekit project HOT 1
- Glob imports must match exactly
- Pass argument to IIFE HOT 2
- Esbuild causing bundle breakage when applied twice to the same bundle
- Splitting results in `Dynamic require of "<filename>" is not supported` when targeting `chrome62`
- [Feature Request] Add built-in HTML loader HOT 1
- Imports from stdio entrypoint don't have a namespace set
- DCE is not removed when value is from a const in another module.
- Get metafile info from a `watch()` rebuild HOT 2
- removes the backslash "\" when minify option is false HOT 4
- [Sourcemap] Private properties don't get sourcemapped correctly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esbuild.