5 ms·
I can't tell what you mean by the last paragraph there, but oftentimes PyPy's speedups come exactly from inlining stuff like what you refer to there -- Python's
by JulianWasTaken 9y ago
I can't tell what you mean by the last paragraph there, but oftentimes PyPy's speedups come exactly from inlining stuff like what you refer to there -- Python's not fundamentally slower, it's those kinds of stuff that you can speed up.
(And yeah the CPython API is still a pain point if you've got a library that uses it, although some stuff will still work using PyPy's emulation layer. It'd be great if people stopped using it though.)
- sillysaurus3 9y agoFor example, Python makes it fairly easy to trap a call to a missing method, both via __getattr__ and __missing__. In JS the only way you can do that is via Proxy objects, and even those have limits. You can't always inline the arithmetic ops effectively. You can recompile the method each time it's called with different types, but that's why the warmup time is an issue. This wouldn't be a problem if Python didn't make it so trivial to overload arithmetic. JS doesn't.
- JulianWasTaken 9y agoAh! Yes, agreed, Python does certainly make it too easy to do things that cannot reasonably be sped up.
- sillysaurus3 9y agoTwist: Lua makes it trivial to overload arithmetic using metatables, but LuaJIT seems to have solved that. If there is any warmup time, it's hard to tell. Mike Pall is a JIT god, and I wish we had more insight into everything that went into producing one of the best JIT's of all time. I'd love a comment/post that highlights the differences between JS and Lua as the reason why LuaJIT was able be so effective. There must be differences that make Lua possible to speed up so much. There are easy ones to think of, but the details matter a lot. EDIT: I found some discussion at https://news.ycombinator.com/item?id=1188246 https://news.ycombinator.com/item?id=1188246 but it left me wanting more. Related: https://stackoverflow.com/questions/4911762/why-is-luajit-so-good https://stackoverflow.com/questions/4911762/why-is-luajit-so... http://article.gmane.org/gmane.comp.lang.lua.general/58908 http://article.gmane.org/gmane.comp.lang.lua.general/58908 http://lua-users.org/lists/lua-l/2010-03/msg00305.html http://lua-users.org/lists/lua-l/2010-03/msg00305.html
- sillysaurus3 9y agoMore: https://www.reddit.com/r/programming/comments/1r2s82/lua_fun_is_a_highperformance_functional/ https://www.reddit.com/r/programming/comments/1r2s82/lua_fun...