top | item 34996435

(no title)

MiddleMan5 | 3 years ago

I'm sure there's some truth to what you're saying here; chiefly that there are some well optimized libraries out there that handle certain types of problems very well, but the comment reads as satire. A fundamental primitive should be built in, provided as the default, and high performance.

Recently I was troubleshooting why a protocol parsing driver we have written in python was performing so far under benchmarks. After hours of debugging I found that an enum had been added to keep track of a specific state, and that it had increased the processing time by 100 times! How am I supposed to trust a language that can't even get the basic data structures right!?

discuss

order

eternityforest|3 years ago

Enums being that slow sounds like something they will probably address at some point.

But in general the whole point of Python is that you rarely need stuff like protocol parsing drivers, you just use premade bytestream parsing engines that have Python bindings if you can, although that's not always practical.

With Python rather than asking "How do I implement this feature from first principles" you can ask "How do I implement this in terms of these large high level blocks that might or might not actually be what the problem logically calls for, but nonetheless they are blazing fast and can do the job, even with the stuff you have to do to adapt them for your task, or do I have to write my own Rust extension".

Of course that doesn't help much with uniformly slow web code, which I would imagine is why Python isn't #1 for web backends, along with typescript being really awesome these days.