Levi: Thanks for the contribution. It was very educational. So Haskell can do mmap() - that's great, and you got better performance than the version in Perl, Python, or Java posted so far.
Did you mean 0.045 s for the non-unicode version? I am still going to argue that it cannot beat C - it might be able to beat my implementation, but if it does, I can just run it in a debugger, see how, and code up the idea in C - given enough time that is. C has the ultimate performance winner - __asm() macro in case the compiler and the optimizer cannot get it right :-) Regarding the primitives, I agree that a skillful scripting language programmer can cut down the number of primitives for a good number of problems, but at the same time I can think of a string operation that would require a lot of primitives in a scripting language to perform. E.g - what if you needed to something crazy like this: for each byte: rotate the bits swap bits 1 and 7 and bits 4 and 5 with some bitmask or bits 4 and 3 with another bitmask etc 20 really odd bit operations For something like this, even if the development time was an issue and not just the performance, I would choose see just because I can do the bit magic without having to look anything up, while in Perl or Python - my scripting languages of choice - I could not do it without having to use a reference. BTW, how many of us could? - if you can rotate the bits (let's be specific and say down) of each byte in a string in Perl or Python without having to look anything up, go ahead and post. -- Sasha Pachev Fast Running Blog. http://fastrunningblog.com Run. Blog. Improve. Repeat. /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
