[erlang-questions] lists:append performance

Vlad Dumitrescu <>
Fri Jul 24 14:32:31 CEST 2009


Hi,

On Fri, Jul 24, 2009 at 14:20, Valentin Micic<> wrote:
> I've always been under an impression that inserting element into the list
> and then reversing the list to convert it from LIFO to FIFO would generally
> be faster then using lists:append/2 to create FIFO immediately. I

> 1) insert (Count) that would always execute an insert like this:
> ["1"|OldList]

Do you mean that insert does the above and then reverts the list, every time?

If yes, that's the explanation (reversing takes a little longer than
traversing the list)

If no, then it would be interesting to see the benchmark code to find
out what you did measure :-)

regards,
Vlad


More information about the erlang-questions mailing list