Time critical sub routines

Time-critical subroutines can be greatly accelerated by simple measures. This with the proviso that they are called non-parallel multiple or recursively.

Access to local variables in subroutines is significantly faster when using the keyword static. See paragraph „Static“ in the article of Dim.

Example

procedure sendBits(var as byte)
  dim i as static byte
  for i=0 to 7
    portb.0 = var.i
  next
endproc

Another is accelerating edict, by avoiding the transfer parameters and global variables uses (in the main program or private classes).

Example

dim sendVar as byte
 
sendVar = 123
sendBits()
 
[..]
 
procedure sendBits()
  dim i as static byte
  for i=0 to 7
    portb.0 = sendVar.i
  next
endproc