To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 332
331  |  333
Subject: 
RE: Speed of RCX interpreting bytecodes: slow
Newsgroups: 
lugnet.robotics.rcx
Date: 
Sun, 2 Jan 2000 00:27:08 GMT
Viewed: 
1512 times
  
Ben jackson wrote...

What I hate about FORTH is that despite the simple concepts, every
implementation uses different names for the same thing...

: TEST2 10000 0 DO I DROP LOOP ; \ Same loop except the loop index is put on

Or in ps,

/TEST1 { 0 1 100000 { pop } for } def

and variations in other flavors which I've long since forgotten (some I
wrote myself!).

Yes, that's why pbForth is "almost ANSI" which means that it is as close to
standard ANSI Forth as I could get. And PS is NOT Forth, it is Forth-like.

I could do more stuff in the loop...it would slow down.

My loop was actually:

int count;

task main() {
CreateDatalog(100);
ClearTimer(0);
count = 0;
while (count <= 1024) {
if (count & 0xff == 0)
AddToDatalog(Timer(0));
count += 1;
}
PlaySound(SOUND_CLICK);
}

That just adds about 4 items to a datalog, (once every 256 loops, for 1024 loops)

pbForth would let you check a timer with 10 msec resolution and add items when
you want...

The H8 should be able to do about 4,000,000, if I remember my H8 docs.
So the interpreter is still amazingly slow.

No, that's false. The H8 is clocked at 16MHZ, with 4 clock cycles per CPU cycle
which is about 4,000,000 CPU cycles per second. The add takes two cycles, and then
you have to figure the loop overhead which is comparing the loop index with a limit,
and then the branch one way or the other, so let a REALLY tight loop take 8 CPU cycles.

This is 500,000 loops per second, so 100,000 in a tight pbForth loop isn't bad for
an interpreter...

Considering that the sensors get updated every 3 msec

Wow, that's good info.  Where did you see that?  I haven't had time to
digest all of the internals sites yet...

The basic RCX interrupt rate is 1000 Hz, and each sensor gets serviced once per
interrupt - so 3.3333 msec is more like it. This is all in Kekoa's tome as well
as Mike Gasperi's page. Yes, ther IS an awful lot of info out there.

Cheers,

Ralph Hempel - P.Eng

--------------------------------------------------------
Check out pbFORTH for LEGO Mindstorms at:
<http://www.hempeldesigngroup.com/lego/pbFORTH>
--------------------------------------------------------
Reply to:      rhempel at bmts dot com
--------------------------------------------------------



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR