After implementing the missing pop-methods[1] in array.pmc I ran both:
$ time parrot t/pmc/intlist_2.pbc
I need a shower.
real 0m0.097s
user 0m0.090s
sys 0m0.000s
$ time parrot t/pmc/intlista_2.pbc
I need a shower.
real 0m3.964s
user 0m1.540s
sys 0m2.410s
Raw timings in gprof's output are 0.05s / 0.63s.
PerlArray is spendig almost all the time in mem_allocate.
I vote for using intlist as the PerlArray base class.
The question arises: should we copy intlist* and make a general class
out of it storing a PMC or a typed UnionVal (like PerlHash), or would a
size parameter in creation time of the intlist plus some multiplications
be acceptable in intlist?
leo
[1]
+ INTVAL pop_integer () {
+ INTVAL nextix = SELF->cache.int_val - 1;
+ INTVAL ret = DYNSELF.get_integer_keyed_int(&nextix);
+ SELF->cache.int_val--;
+ return ret;
+ }
+
+ FLOATVAL pop_float () {
+ INTVAL nextix = SELF->cache.int_val - 1;
+ FLOATVAL ret = DYNSELF.get_number_keyed_int(&nextix);
+ SELF->cache.int_val--;
+ return ret;
+ }
+
+ STRING * pop_string () {
+ INTVAL nextix = SELF->cache.int_val - 1;
+ STRING *ret = DYNSELF.get_string_keyed_int(&nextix);
+ SELF->cache.int_val--;
+ return ret;
+ }
+