lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.37k stars 156 forks source link

Popping in lists is slow #2741

Open advikkabra opened 1 week ago

advikkabra commented 1 week ago

The following code snippet:

q: list[i32] = []
i: i32
for i in range(100000):
    q.append(i)

for i in range(100000):
    q.pop(0)

takes >30s on my machine, while the C++ equivalent takes 1.3s. This is due to inefficiencies in the pop function.