I've run these 2 tests below.

Results don't look really good.
- Parrot consumes ever increasing memory, so it can't even run up to 100000
- its slow (unoptimized build for now - but that doesn't matter yet)
- Parrot is leaking a vtable per new class and worse per new instance
- I'm currently trying to avoid the vtable_clone for new objects with some success - I still have some test errors related to can or type.


Are these 2 programs somehow equivalent?

leo

$ cat o1.pl
#! perl -w
use strict;

for my $i (1 .. 100000) {
        my $o = new Foo();
}
my $o = new Foo();
print $o->[0], "\n";

package Foo;

sub new {
    my $self = ref $_[0] ? ref shift : shift;
    return bless [ 10, 20 ], $self;
}
1;

$ cat o1.pasm

    newclass P1, "Foo"
    find_global P2, "init"
    store_global "Foo", "__init", P2
    addattribute P1, ".i"
    addattribute P1, ".j"

    set I10, 0
    set I11, 20000
loop:
    find_type I1, "Foo"
    new P3, I1
    inc I10
    #sleep 0.0001
    lt I10, I11, loop

    find_type I1, "Foo"
    new P3, I1
    classoffset I0, P3, "Foo"
    getattribute P2, P3, I0
    print P2
    print "\n"
    end

.pcc_sub init:
    classoffset I0, P2, "Foo"
    new P10, .PerlInt
    set P10, 10
    setattribute P2, I0, P10
    inc I0
    new P10, .PerlInt
    set P10, 20
    setattribute P2, I0, P10
    invoke P1



Reply via email to