[Paul Prescod] > ... > When you optimize the snot out of things they tend to start looking > ugly. Perl runs faster than Python. That's probably not a coincidence. More, IMO it's not even true. I can't make time for this now, but on several occasions I've coded the same algorithm in idiomatic Perl and Python, and Python was invariably faster (not talking orders of magnitude, but 10-40%). The catch is that I know something about both implementations, and avoided the sweet spots in both. Perl gets enormous bang out of its line-at-a-time text file input "cheating", and its integrated regexps. Avoid those, and it's generally *slower* in my experience, which is perfectly consistent with the relative messiness of its implementation (all those magic flags aren't passive, they need runtime conditionals to use! Perl can't even inline its refcount manipulations because they're so complicated due to the flags). Against that, line-at-a-time text file input in particular is something that every newbie bumps into at once, and Perl does have a monster advantage there (at least 2x faster, probably closer to 3 on most platforms). Perl doesn't really look like it was designed to "be fast" in general -- it looks like it was designed to be supernaturally fast in specific situations. Best I've been able to tell, that's how it *acts*, too. I'm keen to add comparable (but limited) internal warts to Python, but for *general* speedup ideas we'll be much better off looking to, e.g., Dylan and Squeak. all-that-said-python-is-fast-enough-for-me-already!-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4