Which system is likely to run faster on parrot?
I would propose, estimate the ops you need and test it :)
E.g. call a continuation 1e6 times and communicate state with one global (a lexical is probably the same speed, i.e. a hash lookup)
$ cat a.pasm
new P5, .PerlInt
set P5, 1000000
store_global "foo", P5
new P0, .Continuation
set_addr I0, endcont
set P0, I0
endcont:
find_global P4, "foo"
unless P4, done
dec P4
# store_global "foo", P4 --no need to store, P4 is a reflike thingy
invoke
done:
print "done\n"
end$ time imcc -P a.pasm done
real 0m0.881s
$ imcc -p a.pasm done OPERATION PROFILE
CODE OP FULL NAME CALLS TOTAL TIME AVG TIME
----- ----------------- ------- ---------- ----------
0 end 1 0.000001 0.000001
40 set_addr_i_ic 1 0.000001 0.000001
66 set_p_i 1 0.000001 0.000001
67 set_p_ic 1 0.000004 0.000004
226 unless_p_ic 1000001 0.595025 0.000001
276 dec_p 1000000 0.599946 0.000001
758 store_global_sc_p 1 0.000006 0.000006
760 find_global_p_sc 1000001 1.037922 0.000001
786 new_p_ic 2 0.000011 0.000005
819 invoke 1000000 0.914063 0.000001
883 print_sc 1 0.005299 0.005299
----- ----------------- ------- ---------- ----------
11 4000010 3.152280 0.000001So you can estimate that the more "heavy" opcodes take about 1us, more "light" vtable functions are ~double that speed with the slow, profiling core. CGP (or JIT) is 3 - 4 times faster.
-O3 compiled parrot, Athlon 800, i386/linux
leo
