Quote:
Originally Posted by Greg McKaskle
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.