Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
5 ratings:
 4 out of 5   

Why Is a Timed Loop Slower Than a Regular While Loop in LabVIEW?



Primary Software:
Primary Software Version: 2014
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Professional Development System, LabVIEW Development Systems>>LabVIEW Base Development System

Problem:
When I compare the time it takes for code to execute in a timed loop vs. a regular while loop in LabVIEW, I noticed the timed loop executes the same number of iterations much slower than a regular while loop. Why is a timed loop slower than a regular while loop in LabVIEW?

Solution:
Timed loops were a new feature introduced in LabVIEW 7.1, and one misconception about timed loops is that they execute "faster" than regular while loops.  On the contrary, timed loops actually run slower than while loops due to the tradeoff between speed and determinism.  A timed loop is close to deterministic because it will iterate at the period you specify (although it is not completely deterministic since Windows is not a real-time operating system).  A while loop will simply run as fast as your CPU will allow.  A timed loop is generally used when there is a need for multi-rate timing capabilities, precise timing, feedback on loop execution, timing characteristics that change dynamically, several levels of execution priority, or precise determinism in a real-time operating system.

For more information on using timed loops in LabVIEW, refer the links below.

Related Links:
External Link: Using the Timed Loop to Write Multirate Applications in LabVIEW
KnowledgeBase 3G9I38L1: Timing Sources Available for LabVIEW Timed Loop by Platform

Attachments:





Report Date: 02/01/2005
Last Updated: 01/12/2016
Document ID: 3I0MILFQ

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit