Don't construct unnecessarily asymmetricEqualityTesterArgCompatShims
This speeds up MatchersUtil#equals by about 6-7x.
This commit is contained in:
@@ -279,7 +279,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
j$.isAsymmetricEqualityTester_ = function(obj) {
|
||||
return obj && j$.isA_('Function', obj.asymmetricMatch);
|
||||
return obj ? j$.isA_('Function', obj.asymmetricMatch) : false;
|
||||
};
|
||||
|
||||
j$.getType_ = function(value) {
|
||||
@@ -4494,13 +4494,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) {
|
||||
|
||||
Reference in New Issue
Block a user