Single underlying array for key and value in TIntIntHashMap

Issue #15 new
Rob Eden created an issue

Originally reported by Ismael Juma

TIntIntHashMap has two int arrays and one byte array. It's possible to combine both int arrays into one long array (by bitwise and bitshift operations) or a single int array by storing key and value in consecutive slots. The latter has the disadvantage that we can store less entries, but it's potentially faster. It would also be nice if we could get rid of the byte array, but we'd have to give up 4 bits of the hashCode for that, which is more controversial.

The main advantage is to reduce cache misses.

Comments from the original:

Ismael Juma

"The latter has the disadvantage that we can store less entries, but it's potentially faster" Thinking about it, it may not even be faster in 64-bit machines, so a single long array seems like the better approach.

Comments (0)

  1. Log in to comment