LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CPU and Memory performance

HI,

I have build a big application that acquires data and represents it but the usage of CPU and memory is high. How can I optimize the CPU usage and memory?

My application has serveral vi.

Toni.
0 Kudos
Message 1 of 4
(3,059 Views)
If you program really needs to shuffle a lot of data, high CPU usage could be normal. It all depends. Many times however, a program does way too many unecessary things.
 
It would be difficult to give detailed advice without seeing the code, but here are some ideas for you could check.
  1. Don't constantly resize large arrays (built array, insert into array, delete from array).
  2. Place small wait statements in all toplevel loops.
  3. Use event structures instead of polling loops.
  4. Avoid overlapping objects on the front panel.
  5. Avoid coercions. Use proper datatypes for everything.
  6. Avoid complicated data structures.
  7. Don't set the history lenght of charts to some outrageous value. If you need a long history, stream it to disk.
  8. Don't send many megabytes of data to graphs. Most graphs are less than 1000 pixels wide so you cannot really show more than that anyway.
  9. Don't shuffle data around via value property nodes.
  10. If you need to stream data to file, keep the file open and use low level file IO. High-level file I/O will open and close the file for each operation.
  11. Don't do unecessary operations, take calculations out of loops unless their inputs change (the compiler often does a good job with folding, but still...)
  12. ...
  13. ... (I am sure others have many more suggestions).

Remember, only a few years ago computers where much less powerful but we were still able to write impressive programs. Yes we did! Any code that on the average uses more than a few percent of the CPU times is probably inefficient and wasteful unless it is doing real computations.

If you could attach your code, we could be much more specific.

Message Edited by altenbach on 04-28-2007 10:36 AM

Message 2 of 4
(3,047 Views)
Hi,
 
good answer 😉
 
Anyway I give u the 2 most common problems about that.
 
For CPU Usage:
Are u using a while loop without timing? that makes the PC work continously without stop and takes all the CPU. Insert a wait function inside the loop and u will save most CPU usage. Also try to go to an slower rate (velocity) to make computer use less CPU.
 
For Memory:
Probably u got a memory leak on arrays. Use an Initialize array function to reserve memory space for the arrays, otherwise you can be copying the array and using far more space than u need.
 
Hopefully u will be able to save CPU and memory with those tips  😉
 
 
Regards,

Jaime Cabrera

NI Applications Engineering Spain
0 Kudos
Message 3 of 4
(3,016 Views)
Check out the tutorial Managing Large Data Sets in LabVIEW.  In addition, the panel/pane property Defer Panel Updates can sometimes reduce execution time.
0 Kudos
Message 4 of 4
(2,996 Views)