Of course rust is not performance. Rust is a programming language. Performance is a mix of programmer's ability, clever design and compiler optimizations.
For a long time, Rust == performance because a _lot_ of people moved into Rust that had never really done programming with a concurrency-sane compiled programming language. For them, Rust was synonymous with performance! Many supporting crates reinforced this. Rayon, Tokio (though not "performant", it was an improvement over naive impl), etc made jumping from hello world to parallel/concurrent execution pretty simple…
When rust ≠ performance. a lesson in developer experience
21–25 of 25 posts
Re: When rust ≠ performance. a lesson in developer experience
#22Earlier quoted context omitted.
> Rust also hides allocation. Does it? In Rust you allocate by calling a function. That's exactly the same as C. Are there any langauges that don't allow you to hide allocation behind a function call? > So what you say is definitely true if you do an allocation heavy, heap fragmenting, RAII style of programming. I don't think Rust encourages lots of small allocations. Most of the Rust code I work with does a lot of a…
It's significantly more complex than Java due to the borrow checker and lifetimes in generics.
Re: When rust ≠ performance. a lesson in developer experience
#23I wonder to what extent the complexity of the rust language hurts performance. We all only have so much mental capacity, if much of it is spent on the various different intersections of rust's features, that reduces how much we can spend on making things fast. (I like Rust btw)
The alternatives with the potential to be as fast (C, C++, D, zig) are more complex in this regard because they make memory safety and lifetime tracking something that you have to keep track of in your head. Rust's biggest win is removing that mental overhead while allowing you to achieve the same performance as those other languages.
I.e. don't need to keep track of the memory for each allocation in my HTTP request and make sure I clean it up before closing the connection, I can just allocate some memory _per request_, put stuff in it, and at the end it gets cleaned up, whether I used the memory or not.
Some languages have the idea of "memory allocators" as a native construct, so that you can actually start thinking about managing memory in more sensible terms than "everything individually", e.g. Odin lang.
Re: When rust ≠ performance. a lesson in developer experience
#24Earlier quoted context omitted.
> Rust also hides allocation. Does it? In Rust you allocate by calling a function. That's exactly the same as C. Are there any langauges that don't allow you to hide allocation behind a function call? > So what you say is definitely true if you do an allocation heavy, heap fragmenting, RAII style of programming. I don't think Rust encourages lots of small allocations. Most of the Rust code I work with does a lot of a…
It's significantly more complex than Java due to the borrow checker and lifetimes in generics.
Re: When rust ≠ performance. a lesson in developer experience
#25Earlier quoted context omitted.
For a long time, Rust == performance because a _lot_ of people moved into Rust that had never really done programming with a concurrency-sane compiled programming language. For them, Rust was synonymous with performance! Many supporting crates reinforced this. Rayon, Tokio (though not "performant", it was an improvement over naive impl), etc made jumping from hello world to parallel/concurrent execution pretty simple…
What is not performant about tokio? Do you know a better async runtime? I also heard tokio's "multi-thread" scheduler had some performance issues.
async != performance
async == concurrency
Unless you face a specific kind of slowdown, concurrency, and therefore async (and therefore tokio) is not a panacea. Many do face that slowdown, so for many it is.