4 ms·
> That is not true. BigInt has been available for a bit already. performance-wise, BigInts are terrible. Tried to use them, made things about a hundred times s
by mschuetz 5y ago
> That is not true. BigInt has been available for a bit already.
performance-wise, BigInts are terrible. Tried to use them, made things about a hundred times slower. What JS needs are 64 bit integer types, and some form of typing system that allows differentiating between various number types.
- felixfbecker 5y agoGenuine question: I imagine most data science things involve arrays of numbers, not just single numbers. JS has UInt8Array, i.e. it does kinda have integers if you want them in an array anyway. Can that speed things up?
- deleted 5y ago[deleted]
- mschuetz 5y agoIn my case, it did involved reading binary files from ArrayBuffers where some attributes were stored as int64. I've been using DataView to read BigInt64s and then used those frequently. Was terribly slow. I've then reverted to alternatives wherever possible, e.g. immediately converting the BigInt64s to Numbers/Doubles where 53 bit integers were sufficient, or splitting down to two 32 bit integers and do some more involved bit magic on them. Much faster, but overall I wasn't happy with the whole process and complexity. I'd rather have native 64bit integer values in JS.
- spion 5y agoThe JIT that understands what number type you want and switches between 31 bit ints and doubles when assumptions are violated without big performance loss. Something similar is likely possible with bigints and 64bit ints