[erlang-questions] I/O performance when reading from stdin
Sat Jan 10 23:36:15 CET 2009
2009/1/11 Hynek Schlawack <hs@REDACTED>:
> I'm starting to learn and love Erlang and wanted as a small exercise
> implement a word occurrence counter for http://ptrace.fefe.de/wp/ .
> To say it kindly, Erlang isn't built for string operations. :) My
> (mostly approved by #erlang) version is twice as slow as the slowest
> already submitted.
I am only an Erlang / FP noob but I would not be surprised that the
Erlang code is slower as it is not really equivalent to the other
implementations : for example the python implemenation
http://ptrace.fefe.de/wp/wp.py is streaming over stdin and only
accumulating the word counts in a dictionary.
Whereas the erlang implementation reads the entire file into memory,
with the overheads that are needed for storage and processing by ets.
More information about the erlang-questions