At 12:19 PM -0800 12/27/03, Joe Wilson wrote:

I implemented the same variable argument function "varargs_adder" in both Perl 5 (addit.pl) and Parrot (f4.pasm). The variable arguments can be strings, integers or floats (I wanted to excercise dynamic variable behavior).

I called the function 500000 times in a loop to benchmark it.
The results are not what I expected:

Perl 5.6.1:       2.79 seconds
Parrot (non jit)  5.04 seconds
Parrot (jit)     13.65 seconds

Interesting. However... the two programs aren't equivalent. You're using constant values and putting results onto an existing data structure in perl, so true 'equivalence' requires a few changes to the source. With those in place, I get the following:


Daoine:~/parrot dan$ time ./parrot ~/f4.pasm
21001097.970000

real    0m7.760s
user    0m4.710s
sys     0m0.110s
Daoine:~/parrot dan$ time perl ~/f4.pl
21001097.97

real    0m15.924s
user    0m10.460s
sys     0m0.170s

Though I can't say I'm particularly thrilled with Parrot's speed here. (This is non-JITted, as I'm running it on my iBook and there's no working JIT for me at the moment for some reason) Even allocating the array new every time and using that new array gets:

Daoine:~/parrot dan$ time ./parrot ~/f4.pasm
21001097.970000

real    0m11.875s
user    0m2.960s
sys     0m0.720s

Still faster than perl but, again, I'm not happy at all with the results there.

Also, be aware that for these tests, there are two very important things to note:

1) Perl's data structures (the equivalent of PMCs) been heavily optimized, to date Parrot's haven't been
2) Parrot's Array and SArray values all accept mixed-type data, which perl's arrays do *not* do, and as such have some extra speed hits that perl arrays don't.


Having said that, you've hit on pretty fundamental problem with SArray and Array. I think I may tackle point #2 in a bit, as it ought to be reasonably straightforward to do, and see what falls out of it.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to