[erlang-questions] Optimization for the ++ operator
Thu May 31 13:55:48 CEST 2012
I thought Erlang would optimize the ++ operator when the left side is known
at compile time.
For example, if the compiler sees the following outside of a function
"Foo" ++ Bar
It could rewrite it as:
[$F, $o, $o | assert_list(Bar)]
However, I ran some benchmarks and it seems the optimization does not
happen (on R15B).
With a local dummy implementation of assert_list(Bar), I got that the first
format is 50% slower than the second one.
That said, given the possibility something is odd in my setup, does Erlang
optimize it or not? If not, could it?
Founder and Lead Developer
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions