[PATCH 3/9] Remove device access from loop to make it faster when running in emulation.