Skip to content

Replace rug/GMP with num-bigint

Yorick Peterse requested to merge replace-rug-with-num-bigint into master

This builds on some of the work done by @codec-abc, with a bunch of changes to make sure the various shifting operations work as before.

While num-bigint may perform worse compared to GMP, it has a few benefits:

  1. GMP/rug is having trouble compiling on Windows, due to a Rust bug: https://github.com/rust-lang/rust/issues/47048.

  2. When using GMP you can no longer cross compile the VM, or at least not as easy as cargo build --target=X. This makes it more difficult to for example build a musl build without having to use Docker.

  3. GMP takes a while to compile, much longer than num-bigint. This isn't that big of a deal, but combined with Rust's already slow compile times I'd prefer to keep compilation as fast as possible.

  4. num-bigint is pure Rust. In theory this should make it easier to distribute, as we don't have to worry about also compiling C code. In practise I think this won't matter that much since GMP is such a mature library.

Merge request reports