Skip to content

JS: performance of numeric primops

The JS implementation of some numeric primops use JavaScript's BigInt (see code in rts/js/arith.js).

For performance we should replace this with code only using JS number type.

See h$mul2Word32 for an example where we explicitly use numbers limited to 16-bit range to compute 32-bit multiplications. This was faster than allocating BigInts, performing a BigInt operation, and finally converting back to number values.

Edited by Sylvain Henry
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information