Skip to content

buffer: simplify isNaN checks

Rodrigo Muino Tomonari requested to merge github/fork/sethbrenith/isnan into master

In modern versions of V8, calling isNaN is not substantially slower than the more cumbersome x !== x, so we can use the simpler style.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)
  • buffer
Benchmark results
                                                     improvement confidence   p.value
 buffers\\adjust-offset.js n=1000000 input="float"      -1.71 %            0.3660126
 buffers\\adjust-offset.js n=1000000 input="inf"         3.19 %            0.2990196
 buffers\\adjust-offset.js n=1000000 input="large"       2.07 %            0.6073530
 buffers\\adjust-offset.js n=1000000 input="medium"     -5.21 %          * 0.0116013
 buffers\\adjust-offset.js n=1000000 input="nan"         1.14 %            0.5428374
 buffers\\adjust-offset.js n=1000000 input="one"        -2.29 %            0.3348872
 buffers\\adjust-offset.js n=1000000 input="zero"        1.38 %            0.5324238

Merge request reports

Loading