restore another accidentally dropped part of #1468 that was missed in #2004 to address performance regression reported in #1461
restore another accidentally dropped part of #1468 that was missed in #2004 to address performance regression reported in #1461