Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15438 > unrolled thread

all() is slow?

Started by"OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net>
First post2011-11-07 21:00 +0000
Last post2011-11-15 08:02 -0800
Articles 3 on this page of 43 — 18 participants

Back to article view | Back to comp.lang.python


Contents

  all() is slow? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-07 21:00 +0000
    Re: all() is slow? Chris Rebert <clp2@rebertia.com> - 2011-11-07 13:39 -0800
    Re: all() is slow? david vierra <codewarrior0@gmail.com> - 2011-11-07 13:46 -0800
      Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-08 09:06 +1100
        Re: all() is slow? Henrik Faber <hfaber@invalid.net> - 2011-11-08 13:09 +0100
          Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-08 23:14 +1100
          Re: all() is slow? John Posner <jjposner@optimum.net> - 2011-11-08 17:51 -0500
          Re: all() is slow? Tim Chase <python.list@tim.thechases.com> - 2011-11-08 17:56 -0600
      Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-08 19:44 -0500
        Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-09 02:47 +0000
          Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 18:01 -0500
            Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-09 23:11 +0000
              Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 20:26 -0500
                Re: all() is slow? alex23 <wuwei23@gmail.com> - 2011-11-09 19:50 -0800
                  Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 23:40 -0500
                  Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 07:35 +0000
                Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 07:48 +0000
                  Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-10 03:51 -0500
                  Re: all() is slow? gene heskett <gheskett@wdtv.com> - 2011-11-10 08:20 -0500
                  Re: all() is slow? Terry Reedy <tjreedy@udel.edu> - 2011-11-10 14:25 -0500
              Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 20:35 -0500
              Re: all() is slow? Ian Kelly <ian.g.kelly@gmail.com> - 2011-11-09 19:10 -0700
              Re: all() is slow? Ethan Furman <ethan@stoneleaf.us> - 2011-11-10 10:43 -0800
              Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-10 15:37 -0500
                Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 23:07 +0000
                  Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-10 23:35 -0500
                    Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-12 01:18 +0000
                      Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-13 01:28 -0500
                        Re: all() is slow? alex23 <wuwei23@gmail.com> - 2011-11-13 18:50 -0800
                          Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-13 23:48 -0500
                Re: all() is slow? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-11 05:40 +0000
              Re: all() is slow? Ian Kelly <ian.g.kelly@gmail.com> - 2011-11-10 14:19 -0700
                Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 22:56 +0000
              Re: all() is slow? Ethan Furman <ethan@stoneleaf.us> - 2011-11-10 13:47 -0800
          Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-10 10:15 +1100
      Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-09 12:19 +1100
      Re: all() is slow? Chris Rebert <clp2@rebertia.com> - 2011-11-08 17:30 -0800
        Re: all() is slow? Hans Mulder <hansmu@xs4all.nl> - 2011-11-09 16:41 +0100
          Re: all() is slow? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-11-09 09:07 -0800
    Re: all() is slow? John Nagle <nagle@animats.com> - 2011-11-09 14:16 -0800
      Re: all() is slow? alex23 <wuwei23@gmail.com> - 2011-11-09 19:52 -0800
      Re: all() is slow? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-10 19:35 +0000
    Re: all() is slow? BOOK-AZ <amalguseynov@gmail.com> - 2011-11-15 08:02 -0800

Page 3 of 3 — ← Prev page 1 2 [3]


#15526

Fromalex23 <wuwei23@gmail.com>
Date2011-11-09 19:52 -0800
Message-ID<8f077318-a150-4ca2-b6e6-5f8dfcd85d8d@u10g2000prl.googlegroups.com>
In reply to#15515
On Nov 10, 8:16 am, John Nagle <na...@animats.com> wrote:
>      CPython is slow. It's a naive interpreter.  There's
> almost no optimization during compilation.  Try PyPy
> or Shed Skin.

Sometimes people need to understand the performance characteristics of
CPython because it's what they have to use. Pointing them at
alternative implementations isn't an answer.

[toc] | [prev] | [next] | [standalone]


#15556

From"OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net>
Date2011-11-10 19:35 +0000
Message-ID<Xns9F9975FB1BD5FOKB@88.198.244.100>
In reply to#15515
John Nagle wrote:

> On 11/7/2011 1:00 PM, OKB (not okblacke) wrote:
>>           I noticed this (Python 2.6.5 on Windows XP):
> 
>      CPython is slow. It's a naive interpreter.  There's
> almost no optimization during compilation.  Try PyPy
> or Shed Skin.

    	PyPy is interesting, but I use various libraries that make use of C 
extension modules.  I'm not going to compile them all myself, which is 
apparently what I would need to do for PyPy.  PyPy or other 
implementations won't work for me unless they're completely drop-in 
replacements for the interpreter.

-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
	--author unknown

[toc] | [prev] | [next] | [standalone]


#15722

FromBOOK-AZ <amalguseynov@gmail.com>
Date2011-11-15 08:02 -0800
Message-ID<98bccd44-92b0-4a98-92c0-fb56a2ce847d@hh9g2000vbb.googlegroups.com>
In reply to#15438
On Nov 7, 1:00 pm, "OKB (not okblacke)"
<brenNOSPAMb...@NObrenSPAMbarn.net> wrote:
>         I noticed this (Python 2.6.5 on Windows XP):
> http://book-az.com
> >>> import random, timeit
> >>> def myAll(x):
>
> ...     for a in x:
> ...         if a not in (True, False):
> ...             return False
> ...     return True>>> x = [random.choice([True, False]) for a in xrange(0, 5000000)]
> >>> timeit.timeit('myAll(x)', 'from __main__ import myAll, x',
>
> number=10)
> 0: 9.7685158309226452>>> timeit.timeit('all(a in (True, False) for a in x)', 'from __main__
>
> import x', number=10)
> 1: 12.348196768024984>>> x = [random.randint(0,100) for a in xrange(0, 5000000)]
> >>> def myAll(x):
>
> ...     for a in x:
> ...         if not a <= 100:
> ...             return False
> ...     return True>>> timeit.timeit('myAll(x)', 'from __main__ import myAll, x',
>
> number=10)
> 4: 2.8248207523582209>>> timeit.timeit('all(a <= 100 for a in x)', 'gc.enable(); from
>
> __main__ import x', number=10)
> 5: 4.6433557896324942
>
>         What is the point of the all() function being a builtin if it's
> slower than writing a function to do the check myself?
>
> --
> --OKB (not okblacke)
> Brendan Barnwell
> "Do not follow where the path may lead.  Go, instead, where there is
> no path, and leave a trail."
>         --author unknown

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.python


csiph-web