addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [python-189] Python performance anti-patterns

From: Alex G.
Sent on: Thursday, January 10, 2013 7:04 PM
I can't reproduce your results:

Alexs-MacBook-Pro-2:~ alex_gaynor$ ~/projects/pypy/pypy-c -mtimeit 'sum(x for x in xrange[masked]))'
100 loops, best of 3: 6.32 msec per loop
Alexs-MacBook-Pro-2:~ alex_gaynor$ ~/projects/pypy/pypy-c -mtimeit 'sum([x for x in xrange(1000000)])'
100 loops, best of 3: 9.38 msec per loop

Alexs-MacBook-Pro-2:~ alex_gaynor$ python -mtimeit 'sum(x for x in xrange[masked]))'
10 loops, best of 3: 61.8 msec per loop
Alexs-MacBook-Pro-2:~ alex_gaynor$ python -mtimeit 'sum([x for x in xrange(1000000)])'
10 loops, best of 3: 59.9 msec per loop


Alex

On Thu, Jan 10, 2013 at 6:45 PM, Bryce Verdier <[address removed]> wrote:
sum(x for x in xrange[masked]))




--
"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero

Our Sponsors

  • Yelp

    Platinum Sponsor, also a host for majority of our events.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy