oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.07k stars 2.67k forks source link

Node.js is 300x faster than Bun at isbot regexp #5197

Open strager opened 1 year ago

strager commented 1 year ago

What version of Bun is running?

1.0.1

What platform is your computer?

Linux 5.19.0-46-generic x86_64 x86_64

What steps can reproduce the bug?

$ # Download the test script and test file: https://github.com/quick-lint/bun-vs-node/tree/f5ca9314fde7432f8b20339b8380bb15203606af/bun-regexp-bug
$ git clone --depth=1 git@github.com:quick-lint/bun-vs-node.git
$ cd bun-vs-node/bun-regexp-bug/

$ node benchmark.mjs               
263487 lines processed
took 201.37601999938488 ms

$ bun run benchmark.mjs         
263487 lines processed
took 65417.94360200001 ms

What is the expected behavior?

Node.js and Bun have comparable performance. Maybe one is twice as fast as the other.

What do you see instead?

Bun is significantly slower than Node.js with this regexp.

Additional information

Possibly related: #3464

vegerot commented 12 months ago

WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=258706

dylang commented 11 months ago

Hi! I don't suppose it's possible to use https://github.com/google/re2 as a replacement to JSC's regex engine until the performance problems can be addressed?

zoto-ff commented 1 month ago

Hi! I don't suppose it's possible to use https://github.com/google/re2 as a replacement to JSC's regex engine until the performance problems can be addressed?

i think no because it's not compatible with JS standarts. you can try to use node-re2