Lists: append / 2 versus erlang: '++' / 2, adding to the end of the list compared to adding to its title

Of the two pairs of comparisons given, which of (each pair) is more expensive than system resources in Erlang:

Qn1: lists:append(L1,L2) compared to erlang:'++'(L1,L2)
Qn2 Write to the beginning of the list with the indication: [NewHead|List]compared to write to the end of the list with:List ++ [NewValue]

I asked about this because there is an intensive part of my program that will read and write to lists. I need to decide whether I will write to the headers of the lists or write their ends, or vice versa.

+5
source share
1 answer

1: - . "append" - "++" ( ). . Erlang++. ?

2: , . , . I.e., AddedStuff ++ Accumulator ( ), "", Accumulator ++ AddedStuff ( ) . , , .

+18

All Articles