improve performance of layers drawing