Word frequency: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: workaround failing syntax highlighting (doesn't seem to know that ' is a symbol character))
Line 2,499: Line 2,499:
</pre>
</pre>



Using IORefs as values in the map seems to give a ~2x speedup on large files:
Using IORefs as values in the map seems to give a ~2x speedup on large files. The below code is based on https://github.com/composewell/streamly-examples/blob/master/examples/WordFrequency.hs , but still using lazy IO to avoid the extra library dependency (in production you should [https://stackoverflow.com/questions/5892653/whats-so-bad-about-lazy-i-o use a streaming library] like streamly/conduit/io-streams):
<lang haskell>
<lang haskell>
module Main where
module Main where