Bun parser is a translation in Zig of ESbuild's parser. ESbuild parser is already well tuned. Bun takes zig advantages to go further.
I wonder how is the performance comparison between the two?
And can I use bun parser as a drop in replacement for esbuild?
ESbuild is much more mature than bun. The author of ESbuild cares a lot about compatibility with other bundlers and stability. Moreover it is already insanely fast. I am not sure there is any interest to switch from ESbuild to bun for bundling or transpiling code.
By the way, I think that bun does not apply the patches of ESbuild since the translation date.
Zigs makes cross compiling easier and is on par with c/c++ in terms of performance. There is no magic trick else just personal preference i assume.
From the page: “Why is Bun fast? An enourmous amount of time spent profiling, benchmarking and optimizing things. The answer is different for every part of Bun, but one general theme: zig's low-level control over memory and lack of hidden control flow makes it much simpler to write fast software.”