respec icon indicating copy to clipboard operation
respec copied to clipboard

Use esbuild instead of rollup

Open sidvishnoi opened this issue 3 years ago • 5 comments

It appears to be a lot faster!

Building respec-highlight (rollup: 2.1s, esbuild: 0.7s):

# rollup
$ time rollup -c worker/rollup.config.js
worker/respec-highlight.js → builds/...
created builds/ in 1.1s
npx rollup -c worker/rollup.config.js  0.03s user 0.15s system 8% cpu 2.154 total

# esbuild
$ time esbuild worker/respec-highlight.js --outdir=builds --bundle --minify --format=iife --global-name=hljs
builds\respec-highlight.js  37.0kb
Done in 14ms
npx esbuild worker/respec-highlight.js --outdir=builds --bundle --minify    0.09s user 0.14s system 33% cpu 0.684 total

Note: The bundle size is slightly larger (like 800 bytes).

sidvishnoi avatar Jul 17 '21 20:07 sidvishnoi

Build w3c profile (with CSS, JS minification) 😱 😮

➜ time node tools/esbuild.js
node tools/esbuild.js  0.00s user 0.00s system 0% cpu 0.258 total
➜  time npm run build:w3c
npm run build:w3c  0.11s user 0.15s system 4% cpu 6.129 total

sidvishnoi avatar Jul 17 '21 22:07 sidvishnoi

Do we get any other goodies from ESBuild? I guess this could be nice for the when we are running the watcher and running tests?

marcoscaceres avatar Jul 19 '21 01:07 marcoscaceres

Yes. Watch mode would be a lot faster now. We can also write ReSpec in TypeScript without waiting on slow compilation feedback, if that's something we want to pursue, for reasons..

sidvishnoi avatar Jul 19 '21 04:07 sidvishnoi

One day... once we fix maybe 80% of current bugs.

marcoscaceres avatar Jul 19 '21 05:07 marcoscaceres

If ReSpec is migrated to TypeScript, it may be possible to use tsc implemented in low-level languages (like Go to speed up type checking in the future.

xfq avatar Jul 18 '22 08:07 xfq