Consider if we should stop using `TotalWrapper` for `OpaqueBitboard` for performance gain
lenguyenthanh opened this issue · comments
As demonstrated in #441, we may have a significant gain in performance by switching from Bitboard
to Long
.
I guess the performance penalty is mostly caused by TotalWrapper
because with it, Bitboard
is be boxed object , not just a primitive Long anymore.
But maybe the opaque type has some responsibility as well.
yes, I started to use that recently and with async-profiler
to understand more about what happen under the hood.
Here is one example I got after running bench-marking with async-profiler.
We can see that, just for Bitboard.contains
it required much more than what needed.
I guess scalalib.newtypes
are over kill for Bitboard
Maybe some inline
for Bitboard.contains
can help a bit in this case, but I think, we can have a much bigger gain if we migrated Bitboard from scalalib.newtypes
.