Performance with and without the garbage collector

Steven D'Aprano steve at pearwood.info
Sat May 14 10:12:32 EDT 2016


Just for kicks, I've been playing around with running code snippets with and
without the garbage collector enabled, looking to see if it will make any
obvious difference to performance.

So far, I haven't found any.

For instance, I tried:

a = [i**3 for i in range(2000000)]
del a[:]

thinking that garbage collecting almost two million ints would surely show
some performance difference, but it doesn't.

Is anyone able to demonstrate a replicable performance impact due to garbage
collection?



-- 
Steven




More information about the Python-list mailing list