Subject:
|
Re: NQC versus Lego RCX Code Speed
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 6 Oct 2000 13:18:56 GMT
|
Viewed:
|
778 times
|
| |
| |
In lugnet.robotics, sjbaker1@airmail.net writes:
> "Wilcox, Doug" wrote:
> >
> > Hmm. This question seems to have gone the way of my PC-->IR Tower cable
> > question.
>
> As I understand it, the situation is this:
>
> * Using the Windoze graphical environment - your 'programs' are translated
> into a special 'byte-code' that's interpreted by the RCX's firmware.
>
> * Using NQC, your C programs are translated into the same 'byte-code' and
> interpreted by the exact same firmware on the RCX.
This is correct.
> * Using LegOS and the *real* GNU C compiler, you get pure machine code
> that doesn't have to be interpreted.
>
> Hence, you would expect the very fastest performance to come from using
> LegOS and a true optimising C compiler.
Hehe :) Yes, this is correct. LegOS is also faster for some other reasons- it
samples the sensors at a much faster rate than the standard firmware, so legOS
programs can react much more quickly than standard bytecode programs.
> You *might* expect NQC and the Lego graphical programming environment to
> produce similar levels of performance - but there is still the possibility
> that NQC uses fewer bytecode instructions than the graphical programming
> environment. That wouldn't suprise me because NQC seems to be very close
> to the raw underlying bytecode - so it could easily be more optimal for
> some (but perhaps not all) programs.
Dave has worked very hard on optimizing his bytecode compiler, and (because of
the structure of NQC, as opposed to the graphical LEGO tools) it is probably
easier for him to optimize than it is for LEGO to do the same.
> As for the other programming environments (Java, etc) - I have no idea.
Quick rundown-
PBForth is interpreted, so while it would not be quite as fast as legOS, it may
yet be faster than the standard firmware.
leJOS, like other Java systems, is byte-compiled Java running on top of a
natively compiled Virtual Machine, which is why Java performance stinks on PCs
:) I have no idea how it stacks up against the native firmware in this regard.
Jose may be able to enlighten us :)
Most of the other options (rcx::pm, etc.) are remote control libraries and
don't run anything on the HW itself.
> > Let me try to get at the point that most interests me--what is the
> > difference, at the RCX level, between programs coded in NQC and programs
> > coded in RCX Code. Is the compiled NQC code closer to the "machine level"?
>
> So the answer to this is "No - it's no closer - but it may still be faster".
>
> To get closer to the machine level (and probably to have your programs run
> at least 10 and perhaps 50 times faster), you should go to LegOS and GNU C.
I've never timed actual programs, but IIRC the sensor sampling (the only thing
that has been directly compared) is on the order of 10 times faster (though I
can't find the emails where Dave and I discussed this in depth- he may recall
better than I do.)
> However, the RCX bytecode with NQC seems pretty much 'fast enough' for
> everything I've tried...things like switches and motors move a glacial
> speeds compared to RCX bytecode...and NQC is just so convenient. Type
> your program in, run NQC, press the RUN button. Action!
Yes, well, there is that convenience thing ;) We're working on it, I swear ;)
Luis
P.S. Don't forget that the LEGO + Linux HOWTO is useful for Windows and Mac
users too, for exactly this type of information. It is here:
http://linuxdoc.org/HOWTO/mini/Lego-HOWTO/
I hope to release a new version some time this weekend, fixing a few bugs and
adding some of the Java options I found out about earlier this week.
|
|
Message has 1 Reply: | | RE: NQC versus Lego RCX Code Speed
|
| (...) (URL) Is a note I posted a while back on pbForth speed. It really is very fast - not as quick as legOS, but fast enough for what we're doing. In fact, NQC and native firmware is fast enough - we just don't have enough variables.... As a point (...) (24 years ago, 6-Oct-00, to lugnet.robotics)
|
Message is in Reply To:
| | Re: NQC versus Lego RCX Code Speed
|
| (...) As I understand it, the situation is this: * Using the Windoze graphical environment - your 'programs' are translated into a special 'byte-code' that's interpreted by the RCX's firmware. * Using NQC, your C programs are translated into the (...) (24 years ago, 6-Oct-00, to lugnet.robotics)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|