@mathias
I have a very serious question :) Is it better in case of performance in V8 to cast function to boolean explicitly? like `if (foo) {}` vs `if (!!foo) {}`?
In general, don’t worry about micro-optimizations like these. They’re not going to make a difference in terms of real-world app performance.
-
-
But what if it's a library which aim is performance? Will it be a micro-optimization if I invoke toBoolean in my code instead of V8?
-
Trying to outsmart the JavaScript engine is a losing game. I’d want V8 to do as much as possible. Seriously, if `!!foo` vs `foo` is your performance bottleneck, then your application is fast enough

- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.