3 ms·
They are presented as options, it's just that their performance sucks. From the article: if not mylist: # 1.061 if len(mylist) == 0: # 1.924
by warkdarrior 2y ago
They are presented as options, it's just that their performance sucks. From the article:
if not mylist: # 1.061
if len(mylist) == 0: # 1.924
- James_K 2y agoI feel like, if you care about performance, using Python at all is a mistake.
- tantalor 2y agoFor most applications, the choice of algorithms and data structures has more impact on performance than programming language.
- LegionMammal978 2y agoThe one big exception to this I've found is working with image data. When you have over a million pixels, you'll have a slow time transforming them unless you can process each one within nanoseconds. Even a compiled language like Rust will struggle with image data if you build it in debug mode. So there's really always going to be a place for optimized implementations of those sorts of things.
- chikere232 2y agoThen caring about a microptimisation over readability would still be the wrong call
- bogwog 2y agoWhen you profile your code and find that all you gotta do is change a few if statements for a 2x perf boost, that will be a happy day.