Clock lists should be type stable
ltratt opened this issue · 3 comments
ltratt commented
Some VMs will optimise things like:
x = [-1] * 10
for i in range(10):
x[i] = 0.0
in a way that allocates a list of unboxed ints on line 1, and then reallocs the list on line 3 to be a list of unboxed floats. We should create an array whose members never change type.
vext01 commented
In terms of JS, we had hoped to use typed arrays, however:
- There's no unsigned 64-bit type in the API (or 64-bit integer for that matter)
- Support is not universal.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
So we will use NaN instead.