Alias null
L3P3 opened this issue · comments
Benchmark showed 2 things:
- Explicitly comparing to
null
is faster than implicit casting (https://jsben.ch/pKNKz) - Caching
null
in a globalconst
is just as fast as usingnull
directly everywhere while reducing file size (https://jsben.ch/LpFcF)
IS
If something is optional, explicit comparision to null
is already used almost everywhere.
At any location null
is used, it is used by its native name.
SHOULD
null
should be cached in a global constant and that constant should be used everywhere instead.