Message236262
The Modules/_randommodule.c implements the 32-bit version of the MersenneTwister and its struct uses (unsigned long) for each of the 624 elements of the state vector.
On a 32-bit build, the unsigned longs are 4 bytes. However, on a 64-bit build, they are 8 bytes each eventhough only the bottom 32-bits are used. This causes the random object to be twice as big as necessary. sys.getsizeof(_random.Random()) reports 5016 bytes. This wastes memory, grinds the cache, and slows performance.
The (unsigned long) declaration should probably be replaced with (uint32_t). |
|
Date |
User |
Action |
Args |
2015-02-20 10:18:42 | rhettinger | set | recipients:
+ rhettinger, serhiy.storchaka |
2015-02-20 10:18:42 | rhettinger | set | messageid: <1424427522.46.0.066480034722.issue23488@psf.upfronthosting.co.za> |
2015-02-20 10:18:42 | rhettinger | link | issue23488 messages |
2015-02-20 10:18:41 | rhettinger | create | |
|