use Time::HiRes qw(time);
use Inline C => Config =>
#OPTIMIZE => '-O0',
FORCE_BUILD => 1;
use Inline C => <<'EOC';
void foo() {}
void foo_bar(int x) {
int i;
for(i = 0; i < x; i++){
foo();
}
}
EOC
$iterations = 10000000;
$t = time;
foo() for 1 .. $iterations;
print "# ", time - $t, "\n";
$t = time;
foo_bar($iterations);
print "# ", time - $t, "\n";
####
# 1.02960205078125
# 1.00135803222656e-005
##
##
# 1.10760188102722
# 0.0196361541748047