Support to uint64/int64 integer (non float data type) values

Hello. I’m currently creating load tests for services that uses proto buffer. In those protobuf data structure, there are some fields that are long/uint64 data type. If I want to create one of those fields the k6 core is not able to support those values since k6 JavaScript ES2015/ES6 version doesn’t support these data types as numbers are 64 bits floating point which only 53 bits are reserved for the interger part. Newer versions of JavaScript support BigInt which is able to store a 64 bit integer.

Is there a plan to support newer versions of JavaScript that support BigInt?

Are there any known work around to store a 64 bit integer value compatible with k6?

Hi @asantos, welcome to the community forum :tada:,

There is a PR for the upstream JS VM to add support for BigInt which seems promising and I am hopeful it might land before the next k6 release (next year at the end Jan/ start of Feb), but it might not so no promises ;).

Looking at MDN the save integer range is pretty big and at least for some of the end values it seems to hold okay with the last k6 v0.35.0 (probably all the previous as well). So as long as you don’t expect values outside of those (or are okay with them not being exact in those cases) I don’t see a problem using just general Numbers for now :).

You can obviously also build with this PR now if you are not running test in the k6 cloud (and are willing to possibly having to debug some stuff) or even make an extension to support this in another way :man_shrugging:

Hope this helps you and I promise to write here if/when the PR gets merged :wink:

1 Like