NXC compiler optimisation level

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

NXC compiler optimisation level

Post by h-g-t »

Under the 'preferences' menu in Bricx Command Center there is a reference to the NXC compiler optimisation level. Am I correct in assuming that the higher the number the smaller the final program or does it refer to the speed of the compiled program?

When the brick is not attached and I have opted to save the compiler output, I get both .sym &.rxe files. Which (if any) of these two is the file to be stored in the brick? Sorry that this is so basic but I am new to this system, last time I programmed it was using Excel keystroke macros!
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC compiler optimisation level

Post by afanofosc »

Level 2 optimization is what I recommend that people use unless they run into an optimizer bug. There used to be a lot of level 2 bugs but most of them are gone now. Some probably do still remain. If you find one please let me know. Level 1 just removes unused functions and variables but does not fiddle around with the generated NBC otherwise. Level 0 leaves everything and the kitchen sink in (which is a lot). Levels greater than 2 don't really have any affect right now and should not be used.

The .rxe file is what gets sent to the brick. The .sym file is used by the BricxCC variable watch tool and the program pause/single step feature that is in BricxCC but requires that you are running the enhanced NBC/NXC firmware on your NXT (and is not, by any stretch, perfect or fully functional at this time). I used to delete .sym files but I changed it so that they are left behind so you can load a .sym file manually. Each time you compile a program BricxCC loads that programs sym file as the "current program" symbols.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: NXC compiler optimisation level

Post by h-g-t »

OK, thank you for an informative and prompt reply.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 2 guests