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