@philip gave a great OptoScript example, lets look at a visual example…
This simple chart is exactly the same as your chart was.
Lets take a look at whats going on here…
Until the operator turns the button on, the CPU will be going at 100% asking isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?isiton?.....
There is no time to breath, the CPU is just frantic in a very tight loop doing every instruction as fast as it possibly can.
It never releases the CPU for any other task, be it another chart or I/O read/writes or other file system functions, you are telling it to check that On status 100% of the time.
Once the operator turns it on, the CPU will then be 100% busy saying isiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOnisiton?YesTurnItOn....
Again, there is a very tight loop using all the CPU resources to do those two function blocks over and over and over.
When you add the delay command you are telling the SoftPAC software its Ok release its strangle hold on the CPU and allow it to go and do other things while the delay is ticking over. The CPU then can take a breath, go off do less intense things and will keep track of the delay time and come back to the chart when the timer expires.
The FactoryFloor, ioControl and PAC Control manuals recommend at least a 1msec delay, but in the real world you usually can spare many more milliseconds and so can gain even more speed.
In short, every loop (and subloop and subroutine) in every chart in your controller MUST have a delay in it for best performance.
Hope that was helpful and you can, just before you do a download in any controller, make a mental note to ask yourself where each chart has a loop… Do I have a meaningful delay in there?
Adding delays speeds things up.