Here's something very simple I just hacked together to see how
 fast storing and retrieving attribute values is:

    set I1, 1000000

    newclass P1, "Foo"
    addattribute P1, "i"
    find_type I0, "Foo"
    new P2, I0
    new P3, .PerlInt
    set P3, 0
    time N0
L1:
    setattribute P2, 0, P3
    getattribute P4, P2, 0
    inc P3
    lt P3, I1, L1
    time N1
    sub N2, N1, N0
    print N2
    print "\n"
    end

 For 1 million iterations, I get:

  un-JITTED -- 0.42 sec
  JITTED    -- 0.34 sec

 (Incidentally, if I comment out the setattribute and getattribute lines,
  then I get:

  un-JITTED -- 0.11 sec
  JITTED    -- 0.05 sec

  which is the cost of the inc and comparison).

  Simon


Reply via email to