Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add big integers to libstd #11536

Closed
thestinger opened this issue Jan 14, 2014 · 4 comments
Closed

add big integers to libstd #11536

thestinger opened this issue Jan 14, 2014 · 4 comments
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@thestinger
Copy link
Contributor

I'm unsure about whether a pure Rust implementation or an existing MIT/BSD-licensed big integer library should be used. Even reaching acceptable performance for integers that aren't very large is a big task.

There's no open-source library in the same class as GMP for very large integers. It has increasingly better asymptomatic performance than the alternatives as the numbers get larger and highly optimized assembly routines which are important in this domain.

However, the LGPL license of GMP prevents it from being used by default:

  1. dynamic linking
  2. static linking + source available for users to build against the library
  3. static linking + linkable object files for users to link against the library
@brson
Copy link
Contributor

brson commented Jan 15, 2014

I am only interested in doing this if we decide to make big integers the default. Otherwise I think it is appropriate to have them in another crate. In general I would rather not put things in std unless they are vital to the operation of the language. We should instead be encouraging smaller crates and setting that example by doing so in the Rust distribution.

@thestinger
Copy link
Contributor Author

@brson: Well, my opinion is that there's not a need to define a default, in which case it wouldn't have a place in std. I do think it's important for it to be equal to fixed-size integers or people are going to choose the convenience of ignoring overflow. That's already the culture Rust has created because for fast big integers you need to go out of your way to use rust-gmp and they're a pain to initialize.

@thestinger
Copy link
Contributor Author

I don't think we should include big integers in the standard library if it's not a competitive implementation. As the only realistic option is GMP and it isn't viewed as acceptable, I no longer want to do this.

@lucian1900
Copy link

Since there was a discussion between myself and @thestinger on IRC, it might be useful to summarise my point.

If Rust included anything (L)GPL in the stdlib, it would make it unusable for many closed-source software developers. It would effectively kill Rust for game dev and possibly also for iOS/Mac store/Windows Store.

I do agree that there should be a low barrier to using bigints. Perhaps the solution is an official (curated) list of libraries that are not necessarily endorsed, but considered of good quality, as @thestinger suggested. Then it would be obvious how to do bigints in Rust (GMP, libtommath or intel's, depending on which license you prefer) without having to include anything in the stdlib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

3 participants