Boolean() vs !!
JavaScript performance comparison
Info
Testing which is faster in various situations: Boolean(expr)
or
!! expr
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Boolean - Window |
|
pending… |
Boolean - True |
|
pending… |
Boolean - Number |
|
pending… |
Boolean - Function |
|
pending… |
dbl neg - window |
|
pending… |
dbl neg - true |
|
pending… |
dbl neg - num |
|
pending… |
dbl neg - function |
|
pending… |
dbl neg - window (w/ brackets) |
|
pending… |
dbl neg - num (w/ brackets) |
|
pending… |
dbl neg - true (w/ brackets) |
|
pending… |
dbl neg - func (w/ brackets) |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments