haskell-lockfree icon indicating copy to clipboard operation
haskell-lockfree copied to clipboard

Remove one level of indirection for boxed ChaseLev

Open treeowl opened this issue 7 years ago • 5 comments

Previously, we had an IORef (holding an MVector. We can remove one level of indirection by sticking an Array# directly into an IORef. That's not officially supported, but it does work (Edward Kmett has used a similar trick).

Before:

 ChaseLevDeque -> MutVar# -> MVector -> Array#

Now:

 ChaseLevDeque -> MutVar# -> Array#

Note: we previously got the vector size from the MVector; now we get it from the Array#. In many applications MVectors unbox, so getting sizes from them is faster than getting them from Array#s. However, this is not such an application: we're continually storing and retrieving the vectors. I expect the array size checks will be cost the same as they did before, but array indexing should be faster.

treeowl avatar Jul 21 '18 22:07 treeowl

Note: if this looks like a good idea, we should also do the same for the Unboxed version.

treeowl avatar Jul 21 '18 22:07 treeowl

I'm having trouble working out how to update the CI with the necessary primitive version. Any help would be appreciated.

treeowl avatar Jul 22 '18 20:07 treeowl

@RyanGlScott , can you maybe help me figure out this CI issue?

treeowl avatar Jul 22 '18 22:07 treeowl

@wangbj, Ryan Scott thought you might be able to review this.

treeowl avatar Aug 08 '18 17:08 treeowl

@treeowl I’ll try, btw the ci issue should be fixed if you merge master branch

wangbj avatar Aug 08 '18 19:08 wangbj