discord / erlpack

High Performance Erlang Term Format Packer
MIT License
220 stars 65 forks source link

JavaScript now has 64-bit integer support #17

Open LJNeon opened 5 years ago

LJNeon commented 5 years ago

With the addition of BigInt, JavaScript now has a type that can reliably store snowflakes as Integers. This type has been in node.js for almost a year now, and uses an average of 40% less memory to store snowflakes compared to Strings. I haven't tested it, but I also suspect this will be easier and/or faster to convert to than Strings are as well. For full disclosure, tests done by the Dyno team showed that the 40% decrease in memory for snowflakes made no noticeable difference in the total memory usage. I'm not stating that erlpack absolutely must switch over, as this would also be a major breaking change for the JavaScript DAPI libraries that utilize erlpack, but I thought I would at least bring up the idea and invite discussion.

devsnek commented 5 years ago

we experimented with this in discord.js a bit (https://github.com/discordjs/erlpack/tree/feature/bigint) and i also support this in earl (https://github.com/devsnek/earl)