CodePoints.uncons performance optimization?
jamesdbrock opened this issue · 3 comments
It seems to me that these lines in Data.String.CodePoints.uncons
purescript-strings/src/Data/String/CodePoints.purs
Lines 197 to 198 in 157e372
are first slicing the first code unit into a Char string with the JavaScript charAt method
and then converting the Char string to a CodePoint by the boundedEnumChar instance fromEnum method which calls the Javascript charCodeAt method.
We could skip the intermediate string slice of the charAt method and call charCodeAt directly.
Is it doing that because it makes it easier on other backends?
Is it doing that because it makes it easier on other backends?
Maybe. That's a good point.
I tried swapping in a “fast” CodePoints.uncons function in purescript-parsing and couldn't detect any speedup.