Subject: | Loss of time cause BigInt can't work fast with mod_perl |
Date: | Mon, 2 Jul 2007 17:04:50 +0400 |
To: | bug-Math-BigInt-GMP [...] rt.cpan.org |
From: | Nikolay Martynov <nmartynov [...] swsoft.com> |
Hello, TELS!
Its seems that under mod_perl environment the multiplication of two
integer tooks to much time, while under console all ok
Console: elapsed: 0.174578
Mod_perl: elapsed: 31.216795
We using mod_perl-1.29, perl-Math-BigInt-GMP-1.18, gmp-4.1.4-7
Installing new module's does not solve this problem
Test script
-------os2ip.pl-------------------------------
use Time::HiRes qw( gettimeofday tv_interval );
use Math::BigInt lib => 'GMP';
my $os = 'MIIBugIBAAKBgQDVF9Wp+VzCcaw6wtbFKAEEW6vAndJwGP3IsoTDkx0DB9ZcAJ5A
JUSn7iR8M5oaNX5npipP9EcLHHtg3M1HqcXcpN195R3z/QsZd79VC2AHBQIVAL2A
mUoNCuTw/LMejIwDpag00hUp4Ga1y8Cy63QVIfheZ3i6AxKcC/YWD6YEpPEtH/sY
v6HQn2EI/s8v2tb2ad8Dg6t3AoGAeZXp1MqkJllFNl6hAK2dACsIaGAKEeMuuyJG
CROApAIcbc3JX06vjGATm+vyPn8wAQHOcrThzkFp0tqrzJjCA5wuUi4WwG0pPX32
DjkRYA4CgYBW2r4nFIirl+MOHCJMtonMmS9slMcGLrCkIuBIMxSPR9w7Jx+OnU9D
DIOnq53hq0fAQVNROKt7CQN3LxhLBNBa9GmQpDwrKg6PMI1k94tnCsmxhcieNvbX
h9PaqYuw+r/Ko22BU6OdYzhjl8d3rMyzXNZWoJZMOT77Mmb6NiVKDRDrUHHtHkwD
0HgPLlya6LkinokQbc3L9LCh0FqKU2En4AIdgHIiSeEpqcZIH8p7dgIUMQ7ZLtXF
1p1zsF3KZUDZU8NIiz0';
my $base = Math::BigInt->new(256);
my $result = Math::BigInt->new(0);
my $neg = ord($os) >= 0x80 and $os ^= chr(255) x length($os);
my $t0 = [gettimeofday];
for (unpack("C*",$os)) {
$result = ($result * $base) + $_;
}
$elapsed = tv_interval ( $t0, [gettimeofday]);
print "elapsed: $elapsed\n";
-------os2ip.pl-------------------------------
--
Best regards,
Nikolay mailto:nmartynov@swsoft.com
SWsoft, Inc. www.swsoft.com