[erlang-questions] A silly set of questions for a silly application.

David Beynon dave@REDACTED
Sat Mar 15 20:32:04 CET 2008


Hi,

I am currently engaged in a bit of language abuse, specifically  
attempting to use erlang for image processing.  My app consists of  
the following:

A set of image loaders/savers written in C++, connected via ports.

Some image processing code in C++ for the really expensive stuff,  
also connected via ports.

Colour space conversion code in erlang - probably the wrong language,  
but the digraph library convinced me that it was a good idea - it  
figures out the shortest set of conversions between any 2 colour  
spaces and gives me a suitable function.

The initial implementation based its image representation on the  
"array" module, which was fine for my initial small test data sets,  
but completely murdered performance when I got onto full sized images  
(approx 3000*2500 * 3 channel floating point).  After a bit of  
experimentation I more or less doubled the speed by dumping data to a  
list instead, and then increased it by a factor of 10 or so by  
putting in a binary based image representation.  Current performance  
is more or less acceptable.

My questions are essentially as follows:

- Am I correct in thinking that my major performance hit was due to  
the erlang memory manager?  Loading large array and list objects gave  
me an extremely sluggish shell.  Is this due to excessive garbage  
collection?

- If so then is there a sensible way of getting around it, or am I  
better off with binary storage?

If the second one is true then it isn't a huge deal, but I will  
probably end up farming more of the processing to external C++  
helpers.  This isn't a huge deal, but I am trying to go for easily  
readable code with moderate performance rather than the fastest  
possible.  I find erlang excels at readable.

final question: Is this a stupid thing to be doing? '-)

	Dave



More information about the erlang-questions mailing list