This would maximize speed, correct? (Skipping the remainder of the stage). Please take a look below and let me know what you think. It seems from what you have said that if I put an EXIT below the RST in the DAlarmIndex >= DAlarmCount block that I could skip the remainder of that stage's logic, which could be a minimal improvement.
What I currently have is the following. It is currently running at ~900ms for the whole alarm stack. This is quite fast.
SG0:
MATH DAlarmReadTime=TICKms()
DATAINFO DAlarmCount=Length(DAlarmNames)
SETNUMR DAlarmIndex=0
SET RunAlarmLoop
JMP SG1
SG1:
WHILE RunAlarmLoop
IF DAlarmIndex >= DAlarmCount:
DAlarmReadTimer=TICKms()-DAlarmReadTime
RST RunAlarmLoop
JMP S0
<< Alarm Processing Code >>
MATH DAlarmIndex= DAlarmIndex+1
IF LogEvent:
RST RunAlarmLoop
JMP S2
WEND
S2:
<< Alarm logging preprocessing >>
ENTASK CopyElementToLog
IF LogDone:
SET RunAlarmLoop
JMP S1