Need to understand magic timeit method better but here are some examples of different time tests.
from pyparty import Canvas
c=Canvas()
%%timeit
for i in range(10,60):
i**2
100000 loops, best of 3: 4.96 µs per loop
%%timeit
for i in range(10,60):
c.add('circle', radius=i, center=(i,i))
10 loops, best of 3: 192 ms per loop
print "JUST ADDED %s PARTICLEs" % len(c)
JUST ADDED 2050 PARTICLEs
Single Particle index, name
%%timeit
c[5]
1000 loops, best of 3: 845 µs per loop
%%timeit
c['circle_1']
1000 loops, best of 3: 853 µs per loop
%%timeit
c[5:20]
100 loops, best of 3: 9.01 ms per loop
%%timeit
c['circle_1', 'circle_10', 5, 11]
100 loops, best of 3: 2.61 ms per loop
Indexing on attributes of "metaparticle" like name/color are quick
%%timeit
[c.name > 50]
1000 loops, best of 3: 681 µs per loop
%%timeit
c[c.name > 50]
1000 loops, best of 3: 1.55 ms per loop
Itearting on attributes of particles which must be computed are slower
%%timeit
[c.perimeter > 50]
1 loops, best of 3: 6.31 ms per loop
On second run, faster due to caching
%%timeit
c[c.perimeter > 50]
1 loops, best of 3: 1.28 s per loop
%%timeit
[(c.perimeter < 50) & (c.area < 1.0)]
1 loops, best of 3: 12.7 ms per loop
%%timeit
del c[c.area > 0]
10000 loops, best of 3: 30.9 µs per loop