I'm running the following code:
x = []
for i in c:
x = x+i
The result has about 50-100 million elements.
This takes several minutes to run on my PC. How can I accelerate this?
I'm running the following code:
x = []
for i in c:
x = x+i
The result has about 50-100 million elements.
This takes several minutes to run on my PC. How can I accelerate this?
Already compared in join list of lists in python
with Python 2 being faster with .extend than with itertools.chain
An exotique method
l = []
for x in c: l[0:0] = x
among the faster according to stackoverflow.com/questions/12088089/…
For python 3.5 and latter, even more exotic
l = []
for x in c:
l = [l, *x]
Of course sum(c, []) is among worst on all the measurements.