Debian Bug report logs - #256781
ipython: funny behaviour of timeit.timeit and timeit.repeat

version graph

Package: ipython; Maintainer for ipython is Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>; Source for ipython is src:ipython.

Reported by: Dan Christensen <jdc@uwo.ca>

Date: Tue, 29 Jun 2004 02:03:02 UTC

Severity: normal

Found in version 0.6.0-1

Done: Bernd Zeimetz <bernd@bzed.de>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Jack Moffitt <jack@xiph.org>:
Bug#256781; Package ipython. Full text and rfc822 format available.

Acknowledgement sent to Dan Christensen <jdc@uwo.ca>:
New Bug report received and forwarded. Copy sent to Jack Moffitt <jack@xiph.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Dan Christensen <jdc@uwo.ca>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: ipython: funny behaviour of timeit.timeit and timeit.repeat
Date: Mon, 28 Jun 2004 21:48:50 -0400
Package: ipython
Version: 0.6.0-1
Severity: normal

[I manually changed the input prompts to >>> and removed the
output labels.]

On a 2.0GHz P4 laptop (speedstep disabled) running mostly testing:

Python 2.3.4 (#2, May 29 2004, 03:31:27) 
Type "copyright", "credits" or "license" for more information.

IPython 0.6.0 -- An enhanced Interactive Python.

>>> from timeit import *
>>> from time import *
>>> t=Timer("pass","pass",timer=time)
>>> t.timeit(1000000)
0.15831089019775391
>>> t.repeat(1,1000000)
[0.079621076583862305]

Note the factor of two difference!  It's consistent:

>>> t.timeit(1000000)
0.14923691749572754
>>> t.repeat(1,1000000)
[0.080674886703491211]
>>> for i in range(3):
...     t.timeit(1000000)
0.15053701400756836
0.15190696716308594
0.15034103393554688
>>> t.repeat(3,1000000)
[0.080902099609375,
 0.081040859222412109,
 0.080629110336303711]

And it happens with timer=clock too:

>>> t2=Timer("pass","pass",timer=clock)
>>> t2.timeit(1000000)
0.11000000000000032
>>> t2.repeat(3,1000000)
[0.079999999999999627, 0.080000000000000071, 0.090000000000000302]

It also happens with statements other than "pass".  The ratio is
different then, and sometimes the repeat version takes longer
(in one case, consistently 20% longer).

This doesn't happen when the above is run in plain python.

And it doesn't happen using ipython on a dual Xeon machine I have
access to, which also runs Debian testing.

Any ideas what's up?  I've looked at timeit.py and can't see how this
is possible...  Let me know if I can help debug it.

Dan


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.4.26
Locale: LANG=C, LC_CTYPE=C

Versions of packages ipython depends on:
ii  python                        2.3.4-1    An interactive high-level object-o

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Jack Moffitt <jack@xiph.org>:
Bug#256781; Package ipython. Full text and rfc822 format available.

Acknowledgement sent to Dan Christensen <jdc@uwo.ca>:
Extra info received and forwarded to list. Copy sent to Jack Moffitt <jack@xiph.org>. Full text and rfc822 format available.

Message #10 received at 256781@bugs.debian.org (full text, mbox):

From: Dan Christensen <jdc@uwo.ca>
To: 256781@bugs.debian.org
Subject: Re: ipython: funny behaviour of timeit.timeit and timeit.repeat
Date: Tue, 29 Jun 2004 22:30:42 -0400
This seems to actually be a bug in python, although it is worse with
ipython.  It seems like the behaviour depends on the setting of
PYTHONPATH environment variable.  With it unset I get bad behaviour as
I reported previously.  With it set to a directory whose last
component is "python" the t.timeit and t.repeat times almost match.  
Other settings give different results.

Maybe you'd like to reassign this to python?  Python transcripts below.

Thanks,

Dan

jdc@itchy:~$ env | grep PYTHONPATH
jdc@itchy:~$ python
Python 2.3.4 (#2, May 29 2004, 03:31:27) 
[GCC 3.3.3 (Debian 20040417)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> import time
>>> t=timeit.Timer("pass","pass",time.time)
>>> print t.timeit()
0.0915880203247
>>> print t.repeat(1)
[0.077334880828857422]
>>> 
jdc@itchy:~$ mkdir /tmp/foo
jdc@itchy:~$ export PYTHONPATH="/tmp/foo"
jdc@itchy:~$ python
Python 2.3.4 (#2, May 29 2004, 03:31:27) 
[GCC 3.3.3 (Debian 20040417)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> import time
>>> t=timeit.Timer("pass","pass",time.time)
>>> print t.timeit()
0.0935900211334
>>> print t.repeat(1)
[0.078188896179199219]
>>> 
jdc@itchy:~$ mkdir /tmp/python
jdc@itchy:~$ export PYTHONPATH="/tmp/python"
jdc@itchy:~$ python
Python 2.3.4 (#2, May 29 2004, 03:31:27) 
[GCC 3.3.3 (Debian 20040417)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> import time
>>> t=timeit.Timer("pass","pass",time.time)
>>> print t.timeit()
0.0809290409088
>>> print t.repeat(1)
[0.079290151596069336]
>>> 

I've done lots of runs, and the results are fairly consistent.
With PYTHONPATH set to the empty directory /tmp/python, the t.timeit
and t.repeat times are always close.  With it unset, or set to
/tmp/foo, t.timeit always gives a larger time than t.repeat.



Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#256781; Package ipython. Full text and rfc822 format available.

Acknowledgement sent to Jack Moffitt <jack@xiph.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #15 received at 256781@bugs.debian.org (full text, mbox):

From: Jack Moffitt <jack@xiph.org>
To: Dan Christensen <jdc@uwo.ca>, 256781@bugs.debian.org
Subject: Re: Bug#256781: ipython: funny behaviour of timeit.timeit and timeit.repeat
Date: Thu, 1 Jul 2004 08:57:31 -0600
> This seems to actually be a bug in python, although it is worse with
> ipython.  It seems like the behaviour depends on the setting of
> PYTHONPATH environment variable.  With it unset I get bad behaviour as
> I reported previously.  With it set to a directory whose last
> component is "python" the t.timeit and t.repeat times almost match.  
> Other settings give different results.
> 
> Maybe you'd like to reassign this to python?  Python transcripts below.

It's possible.  I've forwarded upstream to the ipython-dev list to see
if anyone has any ideas there.  Based on their response I'll do
something appropriate with the bug report.

jack.



Message sent on to Dan Christensen <jdc@uwo.ca>:
Bug#256781. Full text and rfc822 format available.

Message #18 received at 256781-submitter@bugs.debian.org (full text, mbox):

From: Bernd Zeimetz <bernd@bzed.de>
To: 256781-submitter@bugs.debian.org
Subject: Your bugreport on ipython
Date: Mon, 23 Apr 2007 22:53:26 +0200
Heya,

long time ago you've reported a "funny" behavior in ipython as a bug[1].
   I was not able to reproduce this bug in ipython 0.8.0-1, so I think
it was fixed silently. Therefore I'll close the bugs within the next
days. If you think that the bug still exists, please let us know.

Thanks a lot,

Bernd Zeimetz


[1]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256781
-- 
Bernd Zeimetz
<bernd@bzed.de>                         <http://bzed.de/>



Information stored:
Bug#256781; Package ipython. Full text and rfc822 format available.

Acknowledgement sent to Dan Christensen <jdc@uwo.ca>:
Extra info received and filed, but not forwarded. Full text and rfc822 format available.

Message #23 received at 256781-quiet@bugs.debian.org (full text, mbox):

From: Dan Christensen <jdc@uwo.ca>
To: Bernd Zeimetz <bernd@bzed.de>, 256781-quiet@bugs.debian.org
Subject: Re: Bug#256781: Your bugreport on ipython
Date: Mon, 23 Apr 2007 21:31:12 -0400
Bernd Zeimetz <bernd@bzed.de> writes:

> long time ago you've reported a "funny" behavior in ipython as a bug[1].
>    I was not able to reproduce this bug in ipython 0.8.0-1, so I think
> it was fixed silently. Therefore I'll close the bugs within the next
> days. If you think that the bug still exists, please let us know.

I think it's fine to close it.  I still see a small bias, but it isn't
worth worrying about.

Dan



Reply sent to Bernd Zeimetz <bernd@bzed.de>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Dan Christensen <jdc@uwo.ca>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #28 received at 256781-done@bugs.debian.org (full text, mbox):

From: Bernd Zeimetz <bernd@bzed.de>
Cc: 256781-done@bugs.debian.org
Subject: Re: Bug#256781: Your bugreport on ipython
Date: Tue, 24 Apr 2007 11:58:13 +0200
Heya,

>> long time ago you've reported a "funny" behavior in ipython as a bug[1].
>>    I was not able to reproduce this bug in ipython 0.8.0-1, so I think
>> it was fixed silently. Therefore I'll close the bugs within the next
>> days. If you think that the bug still exists, please let us know.
>>     
>
> I think it's fine to close it.  I still see a small bias, but it isn't
> worth worrying about.
>   


Thanks for your reply. The bug will be closed with this mail, please
reopen it if the problem arises again.

Best regards,


Bernd Zeimetz

-- 
Bernd Zeimetz
<bernd@bzed.de>                         <http://bzed.de/>





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 18 Jun 2007 21:03:31 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 23 13:08:57 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.