4 ms·
Chess engine performance is dependent on fast 64-bit integer operations. How does this implementation deal with javascript ints being limited to 32-bits? Is ems
by tromp 5y ago
Chess engine performance is dependent on fast 64-bit integer operations.
How does this implementation deal with javascript ints being limited to 32-bits?
Is emscriptem somehow able to generate code using WASM's 64 bit ints?
- threatofrain 5y agoI believe JS has access to 64-bit.
- petilon 5y agoJS has access to 64-bit floating point, not int.
- tyleregeto 5y agoJS has BigInt support, a quick Google tells me this is supported by wasm. I'm not sure if they are doing that here or not. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- tempay 5y agoBigInt is often orders of magnitude less performant than int32 so it's unlikely to be helpful in this situation.
- pwython 5y agoUnless you're compiling from something like Cheerp.
- Kubuxu 5y agoIt uses WASM which has 64bit integers.
- brrrrrm 5y ago^ this. Ref: https://webassembly.github.io/spec/core/syntax/types.html#syntax-numtype https://webassembly.github.io/spec/core/syntax/types.html#sy...
- johndough 5y agoSeems to be true. https://mbebenita.github.io/WasmExplorer/ https://mbebenita.github.io/WasmExplorer/ emits i64.mul which is compiled to imul rax, rdi by firefox for the following code snippet: #include <stdint.h> uint64_t multiply(uint64_t a, uint64_t b){ return a * b; }
- Cthulhu_ 5y agoProbably using JS's BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...