Improve perforamnce for BTBuildVariantMatrix