Applying PR from upstream to address performance of mashie.