Piers Cawley wrote:

Leopold Toetsch <[EMAIL PROTECTED]> writes:
These two memcpys are the most heavy part of the operation.


Maybe we should rethink that then and make allocation and
initialization two different phases. Or dictate that

new PObj, IClass

should be treated as if it were a function call with all the caller
saves implications that go with it.

Well, its not only object creation. While this is a bit special and could have a special syntax, the problem is with all delegate usage e.g. for tying.
If we need some extra speed for object creation, we could define it as

  new PObj, IClass, "BUILD"  # call sub in BUILD prop
  new PObj, IClass, "CONSTRUCT"  # call sub in CONSTRUCT prop
  new PObj, IClass   # no init call at all

and just save needed registers, as we know, that a Sub is called (or not).

But as said, it doesn't help here:

$ time perl ff.pl
010
real    0m3.287s

$ time parrot -j  ff.pasm
010
real    0m2.334s

leo :)

Attachment: ff.pl
Description: Perl program

    newclass P1, "FF"
    addattribute P1, 'r'
    find_type I12, "FF"
    new P2, I12

    set I10, 0
    set I11, 500000
loop:
    set I15, P2
    inc I10
    lt I10, I11, loop

    set I15, P2
    print I15
    set I15, P2
    print I15
    set I15, P2
    print I15
    print "\n"
    end
.namespace ["FF"]
.pcc_sub __init:
    classoffset I0, P2, 'FF'
    new P3, .PerlInt
    setattribute P2, I0, P3
    invoke P1
.pcc_sub __get_integer:
    classoffset I0, P2, 'FF'
    getattribute P3, P2, I0
    new P4, .PerlInt
    band P4, P3, 1
    inc P3
    if P4, r1
    set I5, 0
    invoke P1
r1: set I5, 1
    invoke P1

Reply via email to