My current Perl Projects - Rewrite of BigInt/BigFloat - Memory usage

Latest memory consumption stats (Dec. 2002)

The work on Math::BigInt::GMP v1.10 prompted me to do new memory usage stats. The following script was used on a machine with Perl v5.8.0:

perl -e 'use Math::BigInt lib => shift; sleep(100)'

Here is a table, it shows that Math::BigInt::GMP now needs less memory than any other library, including Calc!

Note: The memory always includes Math::BigInt and the denoted library.

Module and versionMemory usage in KB
Perl alone 1212
Math::BigInt v1.64 3108
Math::BigInt::Pari v1.09 3880
Math::BigInt::BitVect v1.11 3148
Math::BigInt::GMP v1.07 3144
Math::BigInt::GMP v1.10 3040

Older memory consumption stats (Sep. 2002)

Here is a list of different BigInt/bignum versions using different libraries and their memory usage. All tests were done under Linux, Perl v5.8.0 (no threading, no debugging, 32 bit):

I used the following command line to get the process in the listing of top to the, well, top (so that I can spot it easily):

perl -le 'for (1..10000) { for (1..10000) { $i = 1; } }'

Here is the output from perl -Mbignum=v:

bignum                   v0.12
Math::BigInt::Lite       v0.11
Math::BigInt             v1.63 lib => Math::BigInt::Calc v0.32
Math::BigFloat           v1.38

The number is the memory reported by top as "SIZE", and I think it means KByte.

Modules used and their versionMemory usage
perl 1188
perl, strict, overload, Exporter 1608
Math::BigInt::Calc v1.32 2068
bignum v0.12 3880
bignum v0.12, Math::BigInt::GMP v1.07 4324
bignum v0.12, Math::BigInt::Pari v1.09 5056
bignum v0.12, Math::BigInt::BitVect v1.11 4320
BigInt v1.63 3028
BigInt v1.63, Bit::Vector v6.1, Math::BigInt::BitVect v1.11 3084
BigInt v1.63, Bit::Vector v6.3, Math::BigInt::BitVect v1.11 3092
BigInt v1.63, Math::GMP , Math::BigInt::GMP v1.07 3092
BigInt v1.63, Math::Pari, Math::BigInt::Pari v1.09 3824
BigInt v1.64 * 3016
BigFloat v1.38 3556
BigFloat v1.39 * 3564

* Preliminary test based on v1.64 gamma [2002-09-30].

Tels
Created: 2002-09-30
Last modified: 2002-12-24
Valid HTML 4.01! No patents!