On Tue, Apr 23, 2013 at 4:11 PM, Gregory Maxwell <[email protected]> wrote: > > Certainly there are cases where any performance hit is not really > acceptable, but I imagine that most uses of integers are not these > places. The alternative of "use a full bignum" seems inelegant > especially if the bignum comes with a big performance/memory/icache > hit even in places where a Sufficiently Smart compiler could > statically prove that a regular integer would suffice.
With a flexible integer type like the one used in CPython, the compiler is free to eliminate the branch for handling the big integer variant and the one for catching overflow. It's only really a cache/memory hit where it has to be (an extra word for the enum variant isn't that bad) but I doubt it will be able to eliminate the runtime cost most of the time. I don't think there's anything wrong with offering it as a library type. I just wish the integer literals were overloadable so it could be as first-class as the other integer types. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
