New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a raw bitmap lookup function #24
Conversation
Got some more performance boost by: * Removing dynamic word size handling. We now use a static 64-bit word size. We can possibly add a 32-bit version as well and statically select an appropriate version based on WORD_SIZE_IN_BITS GHC macro. * Removing testBit which caused an additional branch instruction * Refactor `isCombining` such that GHC can reuse code converting char to int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch with regards to testBit
. I forgot that it uses safe shiftL
internally.
-- accessible memory. | ||
-- | ||
lookupBit64 :: Addr# -> Int -> Bool | ||
lookupBit64 addr# (I# index#) = W# (word## `and#` bitMask##) /= 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe isTrue# (word2Int# (word##
and# bitMask##))
? Just to be absolutely sure that there are no allocations.
Ah, sorry, my bad, isTrue#
does not work here. Nevermind.
let i = ord c | ||
in if i < 768 || i > 125258 | ||
then False | ||
else combiningBitmap i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to prefer this to i >= 768 && i <= 125258 && combiningBitmap i
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't prefer anyone in particular.
Looks good to me :) |
Thanks! Merging this. |
Got some more performance boost by:
can possibly add a 32-bit version as well and statically select an
appropriate version based on WORD_SIZE_IN_BITS GHC macro.
isCombining
such that GHC can reuse code converting char to int@Bodigrim please take a look.