logoalt Hacker News

Dweditlast Friday at 5:50 AM0 repliesview on HN

It wasn't some dummy "add numbers" loop, this was doing math (multiply-add) on large 336-bit integers.

Performance sucked when I used native Javacsript BigInts. When I made my own BigInt by using an array of doubles, and pretended that the doubles were 48-bit integers, performance was much better. Using the arrays meant that all allocation of temporary values completely stopped. I had to write my own multiply-and-add function that would do bigint = bigint * 48-bit number + other bigint + other 48-bit number.