News for hackers. Stuff that matters.
Re:We Rewrote Our Project with Rust and It’s Almost 40X Faster by eternityforest on Thursday March 02, 2023 @01:49AM (#34992846)
Those are not the fundamental primitives of python programming. The base primitives are numpy, sqlite, gstreamer, and whatever other high level blocks exist as an extension module.

Python can be fast as long as you think in terms of "low level doesn't exist, if I'm looping over items myself there's a problem", right up until you have a problem that can't be expressed in terms of very high level blocks.

I suspect they will be faster than other compiled languages though. The safety will make people less afraid to optimize, in C it's pretty much keep it simple or you're screwed, rust actually helps manage complexity instead of seeming to declaring complexity as not a well supported use case.

Re:We Rewrote Our Project with Rust and It’s Almost 40X Faster by MiddleMan5 on Thursday March 02, 2023 @10:00AM (#34996435)
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!?

Re:We Rewrote Our Project with Rust and It’s Almost 40X Faster by eternityforest on Thursday March 02, 2023 @05:54PM (#35003235)
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.