perf(ivy): improve NaN checks in change detection (#32212)

This commit drops our custom, change-detection specific, equality comparison util
in favour of the standard Object.is which has desired semantics.

There are multiple advantages of this approach:
- less code to maintain on our end;
- avoid NaN checks if both values are equal;
- re-write NaN checks so we don't trigger V8 deoptimizations.

PR Close #32212
This commit is contained in:
Pawel Kozlowski
2019-08-20 11:06:59 +02:00
committed by Andrew Kushnir
parent 53f33c1cec
commit 53bfa7c6d6
5 changed files with 5 additions and 91 deletions

View File

@ -8,18 +8,6 @@
import {global} from '../../util/global';
import {RElement} from '../interfaces/renderer';
import {NO_CHANGE} from '../tokens';
/**
* Returns whether the values are different from a change detection stand point.
*
* Constraints are relaxed in checkNoChanges mode. See `devModeEqual` for details.
*/
export function isDifferent(a: any, b: any): boolean {
// NaN is the only value that is not equal to itself so the first
// test checks if both a and b are not NaN
return !(a !== a && b !== b) && a !== b;
}
/**
* Used for stringify render output in Ivy.