R
rbg
Before reading the code below, I want to make it clear that this code
is just a *simple reproduction* of a bug I'm seeing in some
computational biology code. So please don't point out things like,
"why are you using system() to run date?!?".
The problem I'm having is that when I make the array foo[] large, the
calls to system() slow down enormously. I'm measuring this problem
using `perl -dProf ...`
Test case 1 below is slow, test case 2 is faster. The only difference
is LEN = (1<<26) in test case 1 and LEN = (1<<10) in test case 2. I
welcome any ideas on how to debug this bizarre problem.
Thanks!
Ross
Test case 1:
-------------------------
use Inline C;
use strict;
hello();
sub foo {
for my $i (1..1000) {
system('date > /dev/null');
}
}
foo();
__END__
__C__
#define LEN (1<<26)
static char foo[LEN];
void hello() {
int i;
printf("hello world\n");
for (i = 0; i < LEN; i++) {
foo = 0;
}
}
-------------------------
Test case 2
-------------------------
use Inline C;
use strict;
hello();
sub foo {
for my $i (1..1000) {
system('date > /dev/null');
}
}
foo();
__END__
__C__
#define LEN (1<<10)
static char foo[LEN];
void hello() {
int i;
printf("hello world\n");
for (i = 0; i < LEN; i++) {
foo = 0;
}
}
-------------------------
is just a *simple reproduction* of a bug I'm seeing in some
computational biology code. So please don't point out things like,
"why are you using system() to run date?!?".
The problem I'm having is that when I make the array foo[] large, the
calls to system() slow down enormously. I'm measuring this problem
using `perl -dProf ...`
Test case 1 below is slow, test case 2 is faster. The only difference
is LEN = (1<<26) in test case 1 and LEN = (1<<10) in test case 2. I
welcome any ideas on how to debug this bizarre problem.
Thanks!
Ross
Test case 1:
-------------------------
use Inline C;
use strict;
hello();
sub foo {
for my $i (1..1000) {
system('date > /dev/null');
}
}
foo();
__END__
__C__
#define LEN (1<<26)
static char foo[LEN];
void hello() {
int i;
printf("hello world\n");
for (i = 0; i < LEN; i++) {
foo = 0;
}
}
-------------------------
Test case 2
-------------------------
use Inline C;
use strict;
hello();
sub foo {
for my $i (1..1000) {
system('date > /dev/null');
}
}
foo();
__END__
__C__
#define LEN (1<<10)
static char foo[LEN];
void hello() {
int i;
printf("hello world\n");
for (i = 0; i < LEN; i++) {
foo = 0;
}
}
-------------------------