Python论坛  - 讨论区

标题:[python-chinese] 在coLinux下运行python为什么有时比直接在windows下运行都快??

2005年09月07日 星期三 07:45

panhudie nirvana117 at gmail.com
Wed Sep 7 07:45:43 HKT 2005

def loop():
for i in xrange(100000):
for x in xrange(10):
a=[]
a[:]=i,x
 time loop() #windowsXP
CPU times: user 1.80 s, sys: 0.00 s, total: 1.80 s
Wall time: 1.80
time loop() #colinux
CPU times: user 0.00 s, sys: 1.44 s, total: 1.44 s
Wall time: 1.44
  time t=2**10000000 #windowsXP
CPU times: user 1.25 s, sys: 0.00 s, total: 1.25 s
Wall time: 1.25
time t=2**10000000 #colinux
CPU times: user 0.53 s, sys: 0.33 s, total: 0.86 s
Wall time: 0.86
  time sum(xrange(10**6)) #windowsXP
CPU times: user 0.41 s, sys: 0.00 s, total: 0.41 s
Wall time: 0.41
time sum(xrange(10**6)) #colinux
CPU times: user 0.00 s, sys: 0.48 s, total: 0.48 s
Wall time: 0.48
 python在linux下优化得好些吗?
为什么windows的sys一直为0.00呢?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050907/f609543e/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年09月07日 星期三 23:27

Fluke fluke.l at gmail.com
Wed Sep 7 23:27:11 HKT 2005

time函数是哪里的?

On 9/7/05, panhudie <nirvana117 at gmail.com> wrote: 
> 
> def loop():
> for i in xrange(100000):
> for x in xrange(10):
> a=[]
> a[:]=i,x
>  time loop() #windowsXP
> CPU times: user 1.80 s, sys: 0.00 s, total: 1.80 s
> Wall time: 1.80
> time loop() #colinux
> CPU times: user 0.00 s, sys: 1.44 s, total: 1.44 s
> Wall time: 1.44
>   time t=2**10000000 #windowsXP
> CPU times: user 1.25 s, sys: 0.00 s, total: 1.25 s
> Wall time: 1.25
> time t=2**10000000 #colinux
> CPU times: user 0.53 s, sys: 0.33 s, total: 0.86 s
> Wall time: 0.86
>   time sum(xrange(10**6)) #windowsXP
> CPU times: user 0.41 s, sys: 0.00 s, total: 0.41 s
> Wall time: 0.41
> time sum(xrange(10**6)) #colinux
> CPU times: user 0.00 s, sys: 0.48 s, total: 0.48 s
> Wall time: 0.48
>  python在linux下优化得好些吗?
> 为什么windows的sys一直为0.00呢?
> 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 


-- 
Yours,
fluke
fluke at sfcube.net
http://sfcube.net/blog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050907/dc3f2acf/attachment-0001.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年09月08日 星期四 00:18

panhudie nirvana117 at gmail.com
Thu Sep 8 00:18:09 HKT 2005

ipython里面自带的
*ipython*.scipy.org/

 ---------- Forwarded message ----------
> From: Fluke <fluke.l at gmail.com>
> Date: Sep 7, 2005 11:27 PM
> Subject: Re: [python-chinese] 在coLinux下运行python为什么有时比直接在windows下运行都快??
> To: python-chinese at lists.python.cn
> 
> time函数是哪里的?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050908/642e1e30/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年09月09日 星期五 00:44

Fluke fluke.l at gmail.com
Fri Sep 9 00:44:07 HKT 2005

在普通python里面如何计时,有什么时间函数?

On 9/8/05, panhudie <nirvana117 at gmail.com> wrote: 
> 
> ipython里面自带的
> *ipython*.scipy.org/
> 
>  ---------- Forwarded message ----------
> > From: Fluke <fluke.l at gmail.com>
> > Date: Sep 7, 2005 11:27 PM
> > Subject: Re: [python-chinese] 在coLinux下运行python为什么有时比直接在windows下运行都快??
> > To: python-chinese at lists.python.cn
> > 
> > time函数是哪里的?
> > 
> 
> 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 


-- 
Yours,
fluke
fluke at sfcube.net
http://sfcube.net/blog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050909/f373407e/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年09月09日 星期五 03:08

panhudie nirvana117 at gmail.com
Fri Sep 9 03:08:26 HKT 2005

In [32]: timeit.Timer??
Type: classobj
String Form: timeit.Timer
Namespace: Interactive
File: f:\python24\lib\timeit.py
Source:
class Timer:
"""Class for timing execution speed of small code snippets.

The constructor takes a statement to be timed, an additional
statement used for setup, and a timer function. Both statements
default to 'pass'; the timer function is platform-dependent (see
module doc string).

To measure the execution time of the first statement, use the
timeit() method. The repeat() method is a convenience to call
timeit() multiple times and return a list of results.

The statements may contain newlines, as long as they don't contain
multi-line string literals.
"""

def __init__(self, stmt="pass", setup="pass", timer=default_timer):


On 9/9/05, Fluke <fluke.l at gmail.com> wrote: 
> 
> 在普通python里面如何计时,有什么时间函数?
> 
>  On 9/8/05, panhudie <nirvana117 at gmail.com> wrote: 
> 
> >  ipython里面自带的
> > *ipython*.scipy.org/
> > 
> >  ---------- Forwarded message ----------
> > > From: Fluke <fluke.l at gmail.com>
> > > Date: Sep 7, 2005 11:27 PM
> > > Subject: Re: [python-chinese] 在coLinux下运行python为什么有时比直接在windows下运行都快?? 
> > > 
> > > To: python-chinese at lists.python.cn
> > > 
> > > time函数是哪里的?
> > > 
> > 
> > 
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050909/bd15f307/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号