3 ms·
Interesting! The previous example I posted was Python 2.7.12 on Ubuntu 16.04.01. Here is OSX 10.11.5 w/Python 2.7.10 (also inconclusive with respect to speed,
by ratsbane 10y ago
Interesting! The previous example I posted was Python 2.7.12 on Ubuntu 16.04.01. Here is OSX 10.11.5 w/Python 2.7.10 (also inconclusive with respect to speed, but OSX was half the memory):
mb:~ doug$ ./listtuple
The tuple's size is 40028 and the list's size is 40036
Iterating through a 10,000 element list took 0.00113916397095 seconds.
Iterating through a 10,000 element tuple took 0.00111603736877 seconds.
mb:~ doug$ ./listtuple
The tuple's size is 40028 and the list's size is 40036
Iterating through a 10,000 element list took 0.00126791000366 seconds.
Iterating through a 10,000 element tuple took 0.00133585929871 seconds.
mb:~ doug$ ./listtuple
The tuple's size is 40028 and the list's size is 40036
Iterating through a 10,000 element list took 0.00114607810974 seconds.
Iterating through a 10,000 element tuple took 0.00117492675781 seconds.