Announcing overflowing_int: making bigints faster by avoiding them

58 points shponglespore 14 comments

I've been working on a crate for a while called overflowing_int that acts as a wrapper around num-bigint to improve performance in cases where a program needs to deal with integers that are potentially too big to fit in primitive types, but where most actual data does fit. One example would be something like an interpreter for a Python-like language where the default integer type supports bigints, but most programs never actually use that feature.

This crate should serve as a drop-in replacement for num-bigint in most cases, offering a 3x-10x performance improvement in cases where primitive int types are sufficient to represent most actual values, at the cost of roughly a 2x overhead in cases where bigints are actually needed.

While there are a few methods of the original bigint types that necessarily have different signatures, I've worked hard to make the APIs as compatible as possible at the source code level. Suggestions for improvements are welcome!