
27 May
2007
27 May
'07
12:50 p.m.
Hello Bryan, Sunday, May 27, 2007, 3:30:50 AM, you wrote:
I think, given my simple algorithm that means that (==) for ByteStrings is slower than (==) for String. Is this possible?
Yes indeed. Over ByteStrings, (==) is implemented as a call to memcmp. For small strings, this loses by a large margin because it has to go through the FFI.
how about using *unsafe* memcmp import and more complex code for the case of large BS length? a==b | min (length a) (length b) < 20 = memcmp a b .... -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com