[rust-dev] Integer overflow, round -2147483648

Daniel Micay danielmicay at gmail.com
Sun Jun 22 14:23:52 PDT 2014


On 22/06/14 11:39 AM, Evan G wrote:
> Because of memory safety?

Most modern languages are memory safe. They're also significantly easier
to use than Rust, because the compiler / runtime is responsible for
managing object lifetimes.

> Because you want low-level control without absolute speed?

I'm not really sure what you mean by "low-level control". I'm also not
sure why you would want such a thing if not for performance.

> Because of a small memory footprint?

The memory footprint depends more on the application code than anything
else. A language using garbage collection might use 3x as much memory or
more, but using implicit atomic reference counting like Swift avoids the
need for the programmer to manage ownership / lifetimes without
introducing significant memory usage overhead. Rust is a bad choice if
performance isn't critical, because those features exist for the sake of
performance.

> Because of having a good async story without giving up a lot of speed?

Rust has exactly zero support for async / non-blocking I/O. The only
form of I/O in Rust will block a task, meaning each waiting I/O
operation is consuming an entire stack. Avoiding the overhead of a stack
per I/O concurrent operation is the rationale behind async /
non-blocking I/O.

> There are plenty of other features to Rust then "absolute speed". Just
> because that's /your/ usecase for it doesn't mean you should force it on
> others.

The set of design compromises made by the language is ill-suited to a
use case where performance isn't critical. There's a high cost to having
the programmer manage object lifetimes, and a language without the same
focus on performance can avoid this entirely.

Swift shares many of the design characteristics of Rust (like traits),
with C#-style value types and reference types. Rather than references as
values where the programmer has to deal with lifetimes, reference types
have their lifetime managed by a garbage collector (C#) or reference
counting (Swift).

I have a hard time seeing why someone would choose Rust over a language
like that if they didn't care about a focus on performance *across the
application* rather than just for inner loops. Rust's strength is the
ability to build high-level abstractions without making performance
compromises. You can still have low-level control in Swift, but you
can't have both low-level control and high-level / safe abstractions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140622/9a3d2442/attachment.sig>


More information about the Rust-dev mailing list