Doing this with every frame is expensive and creates a lot of garbage. It would be better to maintain the hash on the map, instead of creating an array here with every frame.