7 ms·
It allows you to predictably squeeze more out of your system than you ever could in a higher level language without the worry of weird undefined behavior, buffe
by bjz_ 12y ago
It allows you to predictably squeeze more out of your system than you ever could in a higher level language without the worry of weird undefined behavior, buffer overflows, use-after-frees or segfaults. It also has an expressive static type system that draws a great deal from ML and Haskell.
- jvickers 12y agoDo you have an opinion on how Rust compares to Go?
- bjz_ 12y agoRust and Go do not overlap much other than they are both natively compiled, have curly braces and are backed by 'web' companies. Go was designed for building server software and for encouraging standardized, easy to maintain software. Rust on the other hand is generally targeted at the same areas where C and C++ are used for today.
- MichaelGG 12y agoThe main similarity is that Go was called a systems language for some reason, and the idea is now cached in people's minds.
- jonahx 12y agoCould you explain what differences make Go optimized for server software and Rust for systems software/C replacement? I'm not being rhetorical -- I genuinely don't understand and would like to. Related: Would Rust be a bad choice for backend web development (ie, an alternative for Ruby/Python) and why or why not?
- yonibot 12y agoIt's not mature enough to be a contender for Ruby/Rails or Python/Django yet, but assuming it gets there, it may offer incredible performance. Teepee (a Rust HTTP library under development) put together a page that explains the current state of affairs: http://arewewebyet.com/ http://arewewebyet.com/
- ralfn 12y agoThe mandatory garbage collection by default in Go would be a good example of a trade-off they make differently. A rust programmer must be aware of the complexity of memory management. Although they are not forced to use all of it it, the standard library does expose enough of it, to force every rust programmer to be comfortable with the complexity of it. In return they get the opportunity to write code that can compete with c/c++ in terms of performance, and control over latency, while still retaining safety. >Would Rust be a bad choice for backend web development (ie, an alternative for Ruby/Python) and why or why not? Depends on how much you care about maturity and what timescale the code has to run in production. Rust code will be much faster than equivalent Ruby/Python code, but the memory management of it, will be more complicated. I would argue Go offers a better trade-off in performance, complexity and maturity for those types of projects, even though Rust is a much more interesting language. So, if you can afford to not micro optimize your allocation strategies and just use a garbage collector, i would always choose to do so. Even with a language design as pretty as that of Rust.
- ralfn 12y agoI think some people refer to "Systems language" as a language you would write services and back-end code in, like Java, rather than than a language you would use to write a kernel driver or a render engine, like C. It confused me a bit initially.
- jvickers 12y agoThanks for that reply. It's not made it that much clearer in my mind though, because C and C++ can be used to write fast web servers.
- jonahx 12y agoWhat would be the reason to learn Rust over Haskell? They seem to be about in the same speed ballpark: http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ghc&lang2=rust http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan... Is that not representative, or is the idea that Rust speeds the learning curve with its similarity to Ruby?
- Jweb_Guru 12y ago(1) Even in that benchmark, Haskell is over twice as slow as Rust on average. (2) The Haskell code is nowhere near idiomatic. It is still useful to know that Haskell can be quite fast if necessary, but it likely does not reflect what your actual experience using Haskell would be.
- codygman 12y ago> (2) The Haskell code is nowhere near idiomatic This isn't meant as a personal attack firstly. Secondly, I've heard this said more than a few times lately and am generally curious: Do you know which Haskell examples are idiomatic, which aren't, and why? I feel like in the case of some it's just parroting someone elses argument.
- jakevn 12y agoA glance at the source quickly reveals an unsafe implementation.
- codygman 12y agoI didn't see an import for unsafe or foreign in: fannkuch-redux pidigits binary-trees
- jakevn 12y agofannkuch-redux heavily utilizes unsafe operations on a mutable vector. binary-trees uses artificial strictness for the sake of the benchmark. Nine of the ten Haskell implementations are demonstrations of writing C in Haskell (without reaching C's performance).