For my latest project I wanted to test out SmallUnliftedArray.
I wanted to use it with arbitrary a's however (rather than only those for which a user provides a PrimUnlifted instance),
so I wrote the following interop between Data.Elevator.Strict (from the data-elevator package) and SmallUnliftedArray, called StrictSmallArray:
Notice how not only the 'thunk check' and the indirect jump disappeared, but also all the 'store registers to/restore registers from the stack' code! Huge success!
If you want, we could include StrictSmallArray into Contiguous. Note that data-elevator itself is a tiny library with no dependencies (besides base).
Or if you'd rather not, I might publish this in a separate library.
For my latest project I wanted to test out
SmallUnliftedArray
.I wanted to use it with arbitrary
a
's however (rather than only those for which a user provides aPrimUnlifted
instance), so I wrote the following interop betweenData.Elevator.Strict
(from the data-elevator package) andSmallUnliftedArray
, calledStrictSmallArray
:(NOTE: This of course depends on PR https://github.com/byteverse/contiguous/pull/64 )
I recommend looking at the generated Cmm comparing the following two:
The lazy one looks like:
And the strict one looks like:
Notice how not only the 'thunk check' and the indirect jump disappeared, but also all the 'store registers to/restore registers from the stack' code! Huge success!
If you want, we could include
StrictSmallArray
intoContiguous
. Note thatdata-elevator
itself is a tiny library with no dependencies (besides base).Or if you'd rather not, I might publish this in a separate library.