Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What kind of applications are you using it for?

Coincidentally I tried PyPy today for my shell, which is around 14K lines of completely unoptimized Python code [1]. I have never used PyPy before, despite being a long-time Python programmer.

I didn't expect PyPy to speed it up, just based on my impressions of the kind of workloads PyPy excels at.

In my first test case (parsing a 976 line shell script), PyPy took 2.0 seconds and Cpython took 1.0. And that 2x slower number held up for other a couple other tests.

I will probably try running the benchmark in a loop to see if PyPy's JIT warms up (does it do that?). But I wasn't really expecting to use PyPy -- I just wanted to see how it does, because there aren't many ways to speed up my code without rewriting a good portion of it.

My impression is that JITs don't work well in general for certain workloads, not just PyPy. IIRC LuaJIT is actually slower than Lua for string-processing workloads. It makes a lot of sense in say machine learning applications which are all floating point calculations. But string processing is probably dominated by allocations and locality, and the JIT doesn't do very much there, whether it's LuaJIT or PyPy.

[1] http://www.oilshell.org/



I'd love to see a benchmark on which LuaJIT is significantly slower than Lua, if you have a link.


I probably overstated... I don't think JITs including LuaJIT do much for string manipulation, but that would mean it's on par with Lua.

Off the top of my head I think of Lua/Python as 10-100x slower than C, but LuaJIT might get you within 2x for some numerical workloads. But it will not get you within 2x for string workloads -- it's still in the 10x or worse category.

Someone reported a slower benchmark here but the maintainer argued that is invalid. But he says all the time is within C functions, which is what I was getting at.

https://www.freelists.org/post/luajit/Luajit-string-concaten...

A couple people mention string performance here, without many details:

https://news.ycombinator.com/item?id=12573981

I think the bottom line is that the semantics of Lua strings are completely different than how you manage strings in C, so there's a limit to how much you can optimize the program, even if you have a lot of time to (which the JIT does not.)


Using the C api instead of the FFI is slower in LuaJIT than Lua and vice-versa. So there are still optimal solutions for each one.


Have you tried using Cython to see if it speeds up your code?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: