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