Performance improvement for label generation