Felipe Almeida Lessa <[EMAIL PROTECTED]> writes:

> I love benchmarks, so as I was testing the options, I saw something very
> strange:
>
> $ python2.4 -mtimeit 'x = range(100000); '
> 100 loops, best of 3: 6.7 msec per loop
> $ python2.4 -mtimeit 'x = range(100000); del x[:]'
> 100 loops, best of 3: 6.35 msec per loop
> $ python2.4 -mtimeit 'x = range(100000); x[:] = []'
> 100 loops, best of 3: 6.36 msec per loop
> $ python2.4 -mtimeit 'x = range(100000); del x'
> 100 loops, best of 3: 6.46 msec per loop
>
> Why the first benchmark is the slowest? I don't get it... could someone
> test this, too?

I get similar behaviour.  No idea why.

$ python2.4 -mtimeit 'x = range(100000); '
100 loops, best of 3: 6.99 msec per loop
$ python2.4 -mtimeit 'x = range(100000); del x[:]'
100 loops, best of 3: 6.49 msec per loop
$ python2.4 -mtimeit 'x = range(100000); x[:] = []'
100 loops, best of 3: 6.47 msec per loop
$ python2.4 -mtimeit 'x = range(100000); del x'
100 loops, best of 3: 6.6 msec per loop

Dan
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to