Live data from Hacker News

PyPy 1.4: Ouroboros in practice

morepypy.blogspot.com

21–22 of 22 posts

Re: PyPy 1.4: Ouroboros in practice

#21
Sorry to bother people with this question, but I've spent ages searching my internet history for an answer, to no avail:

A few weeks ago someone posted a Python related link on HN. It was some sort of guide or in-depth analysis, with code snippets. The code snippets did not have any syntax colouring. The background of the site was a nice dark/deep green texture (slightly bluish maybe). The top of the page had a sort of golden bookmark icon in the corner.

If anyone remembers that site please let me know the url or the title. I need to find it again.

Re: PyPy 1.4: Ouroboros in practice

#22
post #17

Interesting and promising. PyPy 1.4: >>>> t1 = time.time(); a=[x*x for x in xrange(1000000)]; time.time()-t1 0.38609600067138672 >>>> t1 = time.time(); a=[x*x+math.sin(x/1000000.) for x in xrange(1000000)]; time.time()-t1 0.42182803153991699 Python 2.7: >>> t1 = time.time(); a=[x*x for x in xrange(1000000)]; time.time()-t1 0.25005197525024414 >>> t1 = time.time(); a=[x*x+math.sin(x/1000000.) for x in xrange(1000000)]…

There is something strange with the example. $ pypy -mtimeit -s'import math; sin=math.sin' \ '[x*x+sin(x/1e6) for x in xrange(1000000)]' 10 loops, best of 3: 156 msec per loop With no division it is slower (?): $ pypy -mtimeit -s'import math; sin=math.sin' \ '[x*x+sin(x) for x in xrange(1000000)]' 10 loops, best of 3: 188 msec per loop CPython shows expected behavior: $ python2.7 -mtimeit -s'import math; sin=math.sin…

With no division it is slower (?)

Very interesting. Looks like sin is faster for arguments less than pi/4 (~=0.7853981633974483):

Edit: "Intel's sin/cos implementation sucks golfballs through gardenhoses for arguments outside of [-pi/4,pi/4]": http://stackoverflow.com/questions/523531/fast-transcendent-...

    $ pypy -mtimeit -s'import math; sin=math.sin; a=0.786' '[sin(a) for x in xrange(1000000)]'
    10 loops, best of 3: 395 msec per loop

    $ pypy -mtimeit -s'import math; sin=math.sin; a=0.785' '[sin(a) for x in xrange(1000000)]'
    10 loops, best of 3: 375 msec per loop

    $ python -mtimeit -s'import math; sin=math.sin; a=0.786' '[sin(a) for x in xrange(1000000)]'
    10 loops, best of 3: 177 msec per loop

    $ python -mtimeit -s'import math; sin=math.sin; a=0.785' '[sin(a) for x in xrange(1000000)]'
    10 loops, best of 3: 155 msec per loop
Post reply on HN