# 1: Replaced time-consuming call on all attributes by a more specific request - responsible for about 90% of running time in my tests. # 2: Minor speedup by calling items() before the for loop (1s in a large layer).