-
Notifications
You must be signed in to change notification settings - Fork 51
More efficient representation of integers #245
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
Comments
Maybe a silly question but are there any statistics on int size used in practice? |
I don't think we have any, but it would be simple to add code, normally Of course, then we would have to look for "representative" test code for which to get the stats. Would the pyperformance benchmarks be representative? Some other set of benchmarks (maybe the Pyston ones)? Or maybe we could try running the standard library test suite? I imagine every application has its own distribution. Nothing is ever easy... Until then, my intuition tells me that the vast, vast majority of integers in almost all Python applications are under 64 bits, and most are easily under 32 bits. We don't really need more precision than that since memory allocation doesn't have much finer granularity. |
I did a test on this a very long time ago (~1990) when designing my own language and found that almost everything fits in two bytes, most in one byte (fewer negative that positive). Since I did cryptography, there were also big numbers, which were in my case about 512 bits (RSA size in these days). The numbers bigger than two bytes, but fewer than 64 were almost none. |
Superseded by #548 |
This is just to track my work on implementing #147. There's some discussion on this already on #231.
The text was updated successfully, but these errors were encountered: