google / google/closure-compiler

Infinity and NaN are not optimized

Open
#2,934 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

`Infinity` and `-Infinity` can be optimized into `1/0` and `-1/0` respectively. `NaN` can be optimized into `0/0`. While there is no size benefit to optimizing `NaN`, there is a performance benefit. `NaN` is a window property. As such, using `NaN` forces the browser to add in extra checks incaseif `window.NaN` is changed by some oafish moron as per the W3 spec which (unfourtunatly) permits the free roam of such idiots.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.