
I changed the program, now it similar to the program from the wiki
(http://www.haskell.org/haskellwiki/Phone_number)
The version with ByteString compared to version with ordinary Strings
works 3.5 times faster.
(I put it to http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2830)
But version with Data.Trie dissapointed me, it works 5 times slover
than version with Data.Map ByteString.
(here is the code http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2829)
Anyway, thanks to everyone who helped me, Haskell is really powerfull
tool in clever hands :)
2009/3/23 wren ng thornton
Vasyl Pasternak wrote:
The entire code I placed on http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2764
Could someone help me to make this code faster? I'd like to see solution that will be elegant and fast, without heavy optimizations, that will make code unreadable. Also, if it possible, prepare the program to support SMP parallelism.
The solution's already been posted, but to make this particular code faster, I recommend using Data.Trie instead of Data.Map ByteString. Tries are faster for lookup since they don't redundantly check the prefix of the query; also they're better for memory usage because they don't store redundant copies of the prefixes.
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-trie
-- Live well, ~wren
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Best regards, Vasyl Pasternak