A lot of the time, they do add performance benefit - and it can be considerable (a quick test showed !! to be consistently faster than Boolean - more than twice as fast in fact)
!!
Boolean
Boolean is as fast as !!. Your test is not accurate. github.com/solidjs/solid/pull/500#...
Run this in both Chrome and Firefox. !! is faster in both, and on Firefox it is almost twice as fast
If you want the simplest test possible, try this - not quite such a pronounced difference, but !! still faster
Not for me.
dev-to-uploads.s3.amazonaws.com/up...
Interesting. It's faster for me both on Mac, Linux, and Android - on both Firefox and Chrome
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A lot of the time, they do add performance benefit - and it can be considerable (a quick test showed
!!
to be consistently faster thanBoolean
- more than twice as fast in fact)Boolean is as fast as !!. Your test is not accurate.
github.com/solidjs/solid/pull/500#...
Run this in both Chrome and Firefox.
!!
is faster in both, and on Firefox it is almost twice as fastIf you want the simplest test possible, try this - not quite such a pronounced difference, but
!!
still fasterNot for me.
dev-to-uploads.s3.amazonaws.com/up...
Interesting. It's faster for me both on Mac, Linux, and Android - on both Firefox and Chrome