[erlang-questions] Reading a big text file from a web server.

rtgreg rtgreg <>
Sat Apr 28 16:17:12 CEST 2007


Hello.

I'm starting to study erlang from the "Concurrent Programming in
Erlang" book available in the website.

To test my knowledge I've decided to port a small Python application
of mine to Erlang but I'm having problems with memory consumption and
performance:

One of the modules has to read a file from a web server in the following format:

Key1 The value for key 1
Key2 The value for key 2
Key3
Begin Key3
The value for key 3 is
a lot longer and we
need several lines
End Key3

Right now my, very naive, implementation is reading the result of
http:request("http://example.com/file.txt") and split it by new lines.
The file is several megabytes long so the memory consumption increases
considerably.

What do you recommend to implement this functionality?

Thanks



More information about the erlang-questions mailing list