On Tuesday 01 December 2009 at 13:31, Patrick R wrote:
> The first GC run that occurs during the runtime of fib.nqp ought
> to catch all of the short-lived PCC structures that are in the first
> group... leaving only long-lived PMCs. Any PCC structures that get
> created after runtime begins should be the same for both the .nqp
> and generated-.pir versions of the program, thus any observed
> differences in execution time would seem to have to be due to
> long-lived gc-ables remaining from the compilation process.
>
> I wrote a short test to check this hypothesis -- at the beginning
> of fib.nqp execution I force a GC run (to clear up any "mostly-garbage
> headers" left over from compilation), and then time the resulting
> execution:
>
> $ cat fib-4.nqp
>
> pir::say(pir::time__N);
> Q:PIR {
> sweep 1
> $P0 = getinterp
> $P0.'run_gc'()
> };
> pir::say(pir::time__N);
>
> sub fib($n) {
> ($n < 2) ?? $n !! fib($n-1) + fib($n-2);
> }
>
> my $N := 28;
>
> pir::say("fib($N) = " ~ fib($N));
> pir::say(pir::time__N);
>
> $ ./parrot-nqp fib-4.nqp
> 1259694448.26969
> 1259694448.28342
> fib(28) = 317811
> 1259694469.60673
>
> As you can see, execution time after a forced GC run at the beginning
> is still about 21 seconds (69.60673 - 48.28342). Running the .pir
> version of the above takes about 9.6 seconds. This tells me that
> it must be the long-lived gc-ables that are making the difference
> in execution time, and not the short-lived structures resulting
> from PCC.
I can't reproduce this; the results are opposite for me.
$ time ./parrot ext/nqp-rx/nqp-rx.pbc fib4.nqp
1259707187.22421
fib(26) = 121393
1259707190.75702
real 0m3.693s
user 0m3.612s
sys 0m0.076s
$ time ./parrot fib4.pir
1259707220.46122
fib(26) = 121393
1259707223.66419
real 0m3.214s
user 0m3.184s
sys 0m0.012s
Yet when I run Callgrind, I get a cost of 7,703,189,522 instructions for the
NQP version and 8,134,562,432 for the PIR version.
One significant difference is that the GC runs 588 times for the NQP version
and
6801 times for the PIR version.
-- c
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev