First tempting micro-successes with PyPy

I spent much of Tuesday working on getting PyPy running SimpleParse.  I have to be honest, I was kinda hoping I'd install PyPy and "pow" I'd have a 20x faster parser engine.  It didn't quite work out that way, it was actually 2x slower, with no real explanation of why.  My poor laptop hasn't been able to compile PyPy successfully yet, which seems to be necessary to get some of the tools to work, so I'm going at the problem from the other side.

Basically I'm planning to build up a grammar piece-by-piece and performance testing to see what causes the slow-down.  Not enough time to get much done on that this evening, but the first few tests were pretty encouraging (compared to Tuesday, anyway).  On a trivial grammar (a := 'a') parsing a large sequence of a's, PyPy was running approximately 45x faster than CPython.  Even with a somewhat more complex grammar (a := [abc]) parsing the same long sequence of 'a's, the speed difference held up... I'm guessing that's mostly due to the object allocator (the test creates N 4-tuples of two ints, a list and an object), which, I'm told, is generally superior to the CPython one.  Hopefully whatever is killing the performance in the real-world case will pop out as I create slightly more complex grammars.

Comments

  1. fijal

    fijal on 02/24/2011 4:46 a.m. #

    There are ways to know what's so slow. Read this for starters: https://bitbucket.org/pypy/pypy/wiki/JitFriendliness

    Other tools are not quite end-user ready, but feel free to pop up on IRC and ask. I use this: https://bitbucket.org/pypy/jitviewer

  2. Mike Fletcher

    Mike Fletcher on 02/24/2011 9:17 p.m. #

    Thanks Fijal, I've already done everything described on the JitFriendliness wiki, and the feeling on IRC was that there's nothing obviously wrong with the code wrt jit-friendliness.

Comments are closed.

Pingbacks

Pingbacks are closed.