In Apex, avoid deep nested loops within the script. You want the fastest path from sensor input to data output.