Naive node.js faster than naive LDC2?
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Aug 21 23:49:44 UTC 2020
On Fri, Aug 21, 2020 at 11:22:27PM +0000, James Lu via Digitalmars-d wrote:
> Bonus: Direct translation of Dlang to Node.js, Node.js faster
> Dlang: 4076 3622 2934 (3544 average)
> Node.js: 2624 2334 2316 (2424 average)
> LDC2 is 46% slower!
Using a class for Complex (and a non-final one at that!!) introduces
tons of allocation overhead per iteration, plus virtual function call
overhead. You should be using a struct instead. I betcha this one
change will make a big difference in performance.
Also, what's the command you're using to compile the program? If you're
doing performance comparison, you should specify -O2 or -O3.
Knowledge is that area of ignorance that we arrange and classify. -- Ambrose Bierce
More information about the Digitalmars-d