Rick,
Sorry, the test sequence I have send is not correct.
But, the original test is correct (difficult to isolate from the class system).
I compare...
variable va variable vb
: a ( -- ) 0 va ! va @ vb ! 1 vb ! vb @ va ! ;
: act a a a a a ;
: loop0 0 ?DO act LOOP ;
: loop1 0 ?DO i loop0 LOOP ;
With...
class cloop
variable va
variable vb
: a 0 self va ! self va @ self vb ! 1 self vb ! self vb @ self va ! ;
: act self a self a self a self a self a ;
: loop0 0 ?DO self act LOOP ;
public
: loop1 0 ?DO i self loop0 LOOP ;
end
cloop build oloop
[TIMING 2048 loop1 TIMING] \ result is 7"
[TIMING 2048 oloop loop1 TIMING] \ result is 3"
Finally, the class version is twice faster.
In the OLOOP object,
* VARIABLE are not true variables but memory offsets
* Each SELF XXXX is equivalent to: ID XT-TABLE[] @ COMPILE,
Probably a adress alignement problem...
Charles
.
Received on Tue Feb 16 1999 - 20:56:14 PST
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.