Queue cleanup

Paul Rubin no.email at nospam.invalid
Wed Sep 1 03:14:32 EDT 2010


Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> writes:
>> Refcounting is susceptable to the same pauses for reasons already
>> discussed.
>
> Doesn’t seem to happen in the real world, though.

    def f(n):
        from time import time
        a = [1] * n
        t0 = time()
        del a
        t1 = time()
        return t1 - t0

    for i in range(9):
       print i, f(10**i)


on my system prints:

    0 2.86102294922e-06
    1 2.14576721191e-06
    2 3.09944152832e-06
    3 1.00135803223e-05
    4 0.000104904174805
    5 0.00098991394043
    6 0.00413608551025
    7 0.037693977356
    8 0.362598896027

Looks pretty linear as n gets large.  0.36 seconds (the last line) is a
noticable pause.



More information about the Python-list mailing list