Access the keys of the collection instead of the layers names and use a set to detect collisions. There is no need to access the duplicate layers themselves. Roughly twice as fast.
Access the keys of the collection instead of the layers names and use a set to detect collisions. There is no need to access the duplicate layers themselves. Roughly twice as fast.