Assuming you mean pairwise addition, Pharo achieves over twice Python speed, in my laptop.
Python version:
from random import randrange
from time import time
def main():
L = [float(randrange(2**52, 2**53)) for _ in range(20000000)]
M = [float(randrange(2**52, 2**53)) for _ in range(20000000)]
t0 = time()
N = [ x+y for x,y in zip(L, M) ]
print('Concluded in', round(1000*(time() - t0)), 'millisec.')
main()
Results:
Python 3.10.5 (main, Jun 9 2022, 00:00:00) [GCC 12.1.1 20220507 (Red Hat 12.1.1-1)] on linux
Type "help", "copyright", "credits" or "license()" for more information.
============ RESTART: /run/media/user/KINGSTON/benchmark_doubles.py ============
Concluded in 1904 millisec.
Pharo 10 version:
| L M N t0 |
Transcript clear.
L := (1 to: 2e7) collect:
[ :each | (( 2 raisedTo: 52 ) to: ( 2 raisedTo: 53 )) atRandom asFloat ].
M := (1 to: 2e7) collect:
[ :each | (( 2 raisedTo: 52 ) to: ( 2 raisedTo: 53 )) atRandom asFloat ].
t0 := DateAndTime now.
M := L with: M collect: [ :x :y | x + y ].
Transcript
show: 'Concluded in '
,
((DateAndTime now - t0) asMilliSeconds asInteger ) asFloat asString
, ' millisec.';
cr.
You mean concatenating the lists or pairwise addition?
I don't expect the former to be slow in python as it would be a primitive implemented in C (although even a simple lisp interpreter can have an advantage here by just concatenating the conses).
For the latter, any language runtime capable of inference should be able to optimize it.
I would expect this microbenchpark in particular to be as fast in LuaJIT as it would be in C, without the risk of undefined behavior if the array boundaries are improperly calculated.