View Single Post
  #5   Spotlight this post!  
Unread 15-03-2012, 22:10
plnyyanks's Avatar
plnyyanks plnyyanks is online now
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,113
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: Desperately need help optimizing

Quote:
Originally Posted by Greg McKaskle View Post
Optimizing code mostly involves measuring it, finding the slowest stuff, or the stuff which is farthest from the time it should execute in, and fixing issues until the performance is what you want. There isn't one problem or one solution.
This. There's a saying that 80% of execution time is spent on 20% of your code. The hard part is finding the 20%. To do that, you'll have to go through your code with a fine toothed comb (metaphorically, that is) and try and make is as efficient as possible. Just make sure that all your loops are appropriately throttled, your code is error-free (handling errors in resource intensive), and that you generally have good coding styles. I also like In Place Element Structures, since they provide a good way to write to memory without wasting too much of it. There was also a really good post detailing some ways to reduce some CPU usage, which a lot of teams are struggling with this year.

If you look around the internet, you'll find that NI is awesome (what else is new?) and has a few really helpful documents on optimizing your code.
http://zone.ni.com/devzone/cda/tut/p/id/3747
http://zone.ni.com/reference/en-XX/h..._memory_usage/
https://decibel.ni.com/content/docs/DOC-15337
http://digital.ni.com/public.nsf/all...256CAB00079F57
http://zone.ni.com/devzone/cda/tut/p/id/11472

Just take some time to go through your code, watch memory/CPU usage closely (it's displayed on the Driver Station 'Charts' tab), and do what you can to bring them down as much as possible.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote