Don't construct unnecessarily asymmetricEqualityTesterArgCompatShims

This speeds up MatchersUtil#equals by about 6-7x.
This commit is contained in:
Steve Gravrock
2020-02-12 13:52:58 -08:00
parent 3be797c8d8
commit 5096d9af4e
4 changed files with 31 additions and 6 deletions

View File

@@ -90,13 +90,15 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
MatchersUtil.prototype.asymmetricMatch_ = function(a, b, aStack, bStack, customTesters, diffBuilder) {
var asymmetricA = j$.isAsymmetricEqualityTester_(a),
asymmetricB = j$.isAsymmetricEqualityTester_(b),
shim = j$.asymmetricEqualityTesterArgCompatShim(this, customTesters),
shim,
result;
if (asymmetricA && asymmetricB) {
if (asymmetricA === asymmetricB) {
return undefined;
}
shim = j$.asymmetricEqualityTesterArgCompatShim(this, customTesters);
if (asymmetricA) {
result = a.asymmetricMatch(b, shim);
if (!result) {