5 ms·
>Well, CPython is embarrassingly slow. Compared to what? Please be specific in your definition of "slow." >Runtimes like PyPy is where we should be looking,
by mjolk 12y ago
>Well, CPython is embarrassingly slow.
Compared to what? Please be specific in your definition of "slow."
>Runtimes like PyPy is where we should be looking, since they implement the full Python language and are fast.
Why should 'we' be looking to PyPy? Have you run a non-trivial application with pypy (v. standard cpy) and found it to be significantly faster?
Even if your code would benefit from JIT, and your code is compatible for running on PyPy, does it benefit more from a compiler switch than CPython + Pandas?
- lucian1900 12y agoCPython is very slow at various things that are common, like function calls and attribute lookup. There is no good reason for this and few runtimes are quite this slow. This sort of overhead adds up and is often annoying to deal with. Yes, I have run non-trivial applications on PyPy and they were significantly faster. Its only downside is libraries that depend on CPython extensions, but there are few of those left. Pandas doesn't do much for removing function call overhead. I don't necessarily have large mathematical datasets, I just want my web service to be easier to write, by not having to care about what CPython is terribly slow at.
- mjolk 12y agoInteresting. Did you profile your code to see where your hot spots were? Whenever I've run web-services on PyPy and got a nice little speed bump, I've found that I could have also made small changes to optimize and get near the same result.
- lucian1900 12y agoYes, the slow bits are often part of complex validation, directly proportional to the number of function calls. Sometimes in arbitrary computation, but that is not so common. I could've manually inlined lots of functions to avoid the overhead on CPython, but I'd have a horrible code base. On PyPy I can simply not care about this aspect, just like in most other languages.
- deleted 12y ago[deleted]
- jo_ 12y agoYour first point is particularly interesting to me. It was my understanding that Javascript was impossibly slow at a few very key operations, like array lookups. (Since it didn't have true numerically backed arrays and instead did hashtable lookups for those types of arrays.) C should be blowing away Javascript in pure array lookups. I'm astonished it's not. What do you suspect is the cause of that?
- lucian1900 12y agoPerhaps you misread. C most likely is, or at least more reliably. JS engines specialise to proper arrays most of the time, though. They're quite remarkably fast, much like PyPy. CPython, the original Python interpreter written in C, is not particularly fast at anything.