7 ms·
It is transpiled from C to Go, meaning 90+% of the effort is mechanized. Ad performance. In some micro benchmarks the Go version is ~4x slower: https://gitlab.
by 0xjnml 1y ago
It is transpiled from C to Go, meaning 90+% of the effort is mechanized.
Ad performance. In some micro benchmarks the Go version is ~4x slower: https://gitlab.com/cznic/libquickjs/-/blob/675ee343753c42341572a006a09fca6fbb4b003c/benchmark_test.go#L19 https://gitlab.com/cznic/libquickjs/-/blob/675ee343753c42341...
However, it's already ~25% faster, in a different benchmark, than another Go JS VM written from scratch: https://pkg.go.dev/modernc.org/quickjs@v0.14.0#hdr-Performance https://pkg.go.dev/modernc.org/quickjs@v0.14.0#hdr-Performan...
I am currently looking around if it can be improved more and there are some ideas to try out.
- Rochus 1y agoThat's an interesting result, thanks. I just calculated the geomean of all relations, which is 4.32. The original C code doesn't seem to make use of GCC-specific tricks such as computed gotos, so your experiment essentially demonstrates the optimization efficiency of the Go compiler compared to the C compiler. It would be interesting to use a more established benchmark suite like Are-we-fast-yet, which has a JS implementation.