And now the stat of Python patched with 30bit_longdigit3.patch.
min/avg/max are now the number of bits which gives better
informations. "bigger" is the number of arguments which are bigger than 1
digit (not in range [-2^30; 2^30]).
make
====
_FromLong: 169734 calls, min=( 0, ), avg=(11.6, ), max=( 32, )
\--> bigger=31086
long_bool: 48772 calls, min=( 0, ), avg=( 0.3, ), max=( 24, )
long_add: 39685 calls, min=( 0, 0), avg=( 6.5, 3.5), max=( 19, 32)
\--> bigger=1
long_compare: 39445 calls, min=( 0, 0), avg=( 9.3, 8.4), max=( 31, 33)
\--> bigger=10438
_AsLong: 33726 calls, min=( 0, ), avg=( 4.9, ), max=(1321, )
\--> bigger=10
long_sub: 13285 calls, min=( 0, 0), avg=( 7.6, 5.6), max=( 13, 13)
long_bitwise: 4690 calls, min=( 0, 0), avg=( 1.7, 1.9), max=( 16, 16)
long_hash: 1097 calls, min=( 0, ), avg=( 8.1, ), max=( 33, )
\--> bigger=4
long_mul: 236 calls, min=( 0, 0), avg=( 1.3, 5.4), max=( 17, 17)
long_invert: 204 calls, min=( 0, ), avg=( 2.4, ), max=( 3, )
long_neg: 35 calls, min=( 1, ), avg=( 4.3, ), max=( 7, )
long_format: 3 calls, min=( 0, ), avg=( 2.0, ), max=( 4, )
long_mod: 3 calls, min=( 1, 2), avg=( 1.7, 2.0), max=( 2, 2)
long_pow: 1 calls, min=( 2, 6), avg=( 2.0, 6.0), max=( 2, 6)
Notes about make:
- PyLong_FromLong(), long_compare(), PyLong_AsLong() and long_hash()
gets integers not in [-2^30; 2^30] which means that all other functions
are only called with arguments of 1 digit!
- PyLong_FromLong() gets ~30.000 (18%) integers of 32 bits
- global average integer size is between 0.3 and 11.6 (~6.0 bits?)
- There are 41.500 (12%) big integers on ~350.000 integers
pystone
=======
_FromLong: 1504983 calls, min=( 0, ), avg=( 5.1, ), max=( 31, )
\--> bigger=14
long_add: 902487 calls, min=( 0, 0), avg=( 3.9, 2.4), max=( 17, 17)
long_compare: 651165 calls, min=( 0, 0), avg=( 1.7, 1.4), max=( 31, 31)
\--> bigger=27
_AsLong: 252477 calls, min=( 0, ), avg=( 4.6, ), max=( 16, )
long_sub: 250032 calls, min=( 1, 0), avg=( 4.0, 1.6), max=( 7, 7)
long_bool: 102655 calls, min=( 0, ), avg=( 0.5, ), max=( 7, )
long_mul: 100015 calls, min=( 0, 0), avg=( 2.5, 2.0), max=( 4, 16)
long_truediv: 50000 calls, min=( 4, 2), avg=( 4.0, 2.0), max=( 4, 2)
long_hash: 382 calls, min=( 0, ), avg=( 8.1, ), max=( 28, )
long_bitwise: 117 calls, min=( 0, 0), avg=( 6.7, 6.6), max=( 15, 16)
long_format: 1 calls, min=(16, ), avg=(16.0, ), max=( 16, )
Notes about pystone:
- very very few numbers are bigger than one digit: 41 / ~4.000.000
- global average integer size is between 0.5 and 6.7 (~3.0 bits?)
- the biggest number has only 31 bits (see long_compare)
Short summary:
- pystone doesn't use big integer (1 big integer for 100.000 integers)
=> don't use pystone!
- the average integer size is around 3 or 6 bits, which means that most
integers can be stored in 8 bits (-255..255)
=> we need to focus on the very small numbers
=> base 2^30 doesn't help for common Python code, it only helps programs
using really big numbers (128 bits or more?) |