I see that Erlang Efficiency User’s Guide Section 5.3 recommends leaving the non-flat list as it is when being used as an iolist because the penalty of non-flattening is smaller than flattening. Is there any quantitative example of the speed difference?
I see that Erlang Efficiency User’s Guide Section 5.3 recommends leaving the non-flat list
Share
When a deep list contains n elements, then performing
lists:flattenon it will require Θ(n) time, and worse, Θ(n) memory allocations. How slow that is on your machine is a function of many variables; measure and ye shall know.