# The following was supposedly scribed by # Maxim Nechaev # on Friday 11 February 2005 01:23 am:
Looks like this one is still dangling. Did you get it solved? If so, let us know. >I'am trying simple benchmark of Inline::Python module and find >uncontrolled grow of used proccess memory. >Benchmark test: I've added a memory-usage dumper, and cranked $n up by a factor of 10 since the original didn't really stress my machine that much. #-------------------------------------- #!/usr/bin/perl use Inline Python => <<'EOC'; def answer(a, b): return a*b EOC use Benchmark; $t = timeit(10_000_000, 'answer(6, 7)'); print timestr($t), "\n"; print 4 * (split(/\s/, `cat /proc/$$/statm`))[0], "\n"; #-------------------------------------- 12:52:41: ~/notes/perl-snippets $perl inline-python-memgrow.pl 8 wallclock secs ( 8.47 usr + 0.05 sys = 8.52 CPU) @ 117370.89/s (n=1000000) 39156 12:53:00: ~/notes/perl-snippets $perl inline-python-memgrow.pl 225 wallclock secs (210.05 usr + 0.69 sys = 210.74 CPU) @ 47451.84/s (n=10000000) 331792 That 331MB certainly seems unreasonable. Now the question is whether it's an Inline::Python issue or a Benchmark.pm/perl problem. I've noticed strange behavior in recent versions of perl with certain supposedly equivalent iterator constructs for large values of $n (IIRC, something like @array = <FILE> taking much longer than my @array;foreach my $line (<FILE>) {push(@array, $line);}) Sorry I'm not going to chase this one any further right now. Maybe if you nag me about it later. --Eric -- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth --------------------------------------------- http://scratchcomputing.com ---------------------------------------------