NBC speed

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

NBC speed

Post by mattallen37 »

How fast does NBC code execute? Is it a fixed speed per line?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: NBC speed

Post by muntoo »

Depends on the operation.

It's a few thousand integer math operations per second, IIRC.

Linus did some great work, but it's lost with NXTasy.

(The topic was called "NXC performance insights", I believe.)
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NBC speed

Post by mattallen37 »

Hmm, I was hoping for specifics.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
linusa
Posts: 228
Joined: 16 Oct 2010, 11:44
Location: Aachen, Germany
Contact:

Re: NBC speed

Post by linusa »

Even though the fruitful discussion with John Hansen and others is lost, my benchmark programs are still there. The comments section at the top contains most of my original article from NXTasy:

http://www.mindstorms.rwth-aachen.de/tr ... ceChk1.nxc
http://www.mindstorms.rwth-aachen.de/tr ... ceChk2.nxc
http://www.mindstorms.rwth-aachen.de/tr ... ceChk3.nxc
http://www.mindstorms.rwth-aachen.de/tr ... ceChk4.nxc

Please note that the Firmware 1.2x seems to be about two times faster than the old 1.0x generation.

Please also note that this doesn't say anything about sensor or motor access, and that you always have to be careful when benchmarking and comparing results.
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
linusa
Posts: 228
Joined: 16 Oct 2010, 11:44
Location: Aachen, Germany
Contact:

Re: NBC speed

Post by linusa »

Oh and I remember one important thing that changed with Firmware 1.2x (or newer NXC versions), which is not yet mentioned in the comments of my Benchmarks: The Wait-command in NXC has changed from "busy waiting that burns CPU time" to a "real sleep, let other tasks use CPU".
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NBC speed

Post by afanofosc »

Definitely not a fixed speed per line of code. Some opcodes take longer to execute than others. Some opcodes with one datatype for its parameters take longer than the same opcode with a different datatype. E.g., mov with byte array inputs will take longer than mov with signed long inputs. It is always best to reveal the hidden motivation behind the question, imho. Why did you hope for specifics about how fast NBC code executes on the NXT firmware?

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NBC speed

Post by mattallen37 »

Thank you very much Linus.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NBC speed

Post by mattallen37 »

Okay, thanks John. I don't know all that much about how CPUs compute, but I though that if it was a fixed speed, I could do timing based on the number of OPCodes. I though maybe I could get higher resolution that CurrentTick gives.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
ronmcrae
Posts: 33
Joined: 28 Sep 2010, 14:56

Re: NBC speed

Post by ronmcrae »

linusa wrote:Oh and I remember one important thing that changed with Firmware 1.2x (or newer NXC versions), which is not yet mentioned in the comments of my Benchmarks: The Wait-command in NXC has changed from "busy waiting that burns CPU time" to a "real sleep, let other tasks use CPU".
I think it is accurate to say that NXC only frees up the CPU during a wait if you are targetting the V1.28 (or higher) ENHANCED FIRMWARE. If NXC code is compiled for, and loaded onto, the standard firmware then I believe that you still get the busy wait.

Ron.
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: NBC speed

Post by gloomyandy »

So the obvious question is why do you need higher resolution then the timer gives you... What is it you are trying to do? If you explain the underlying problem someone may be able to help...
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests