Skip to content

Primitives in Mlton #583

Answered by MatthewFluet
bikallem asked this question in Q&A
Nov 23, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Thanks. Is there any advantage/benefit in using Word8Array/Word8ArraySlice as opposed to CharArray? in terms of efficiency?

None at all in MLton. After front-end type checking, Word8.word and Char.char are the same type.

The blit_ operation is provided by CharArray.copy or CharArray.copyVec or the CharArraySlice variants (depending on the elements to be copied), though those would have bounds checks.

Indeed, I was wondering, does MLton already have unsafe versions of the above specific functions as primitives? If so can I perhaps peruse it? This is useful for performance since most of the Buffer functions already do check bounds and additional bounds check by the Basis lib seems a bi…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@MatthewFluet
Comment options

Answer selected by bikallem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants