3 ms·
"I read that and wondered why they don't default to a double, instead of an int? Double is javascripts internal type so the effort seems wasted." Ints take up
by chrisseaton 12y ago
"I read that and wondered why they don't default to a double, instead of an int? Double is javascripts internal type so the effort seems wasted."
Ints take up less space and often take less cycles to perform arithmetic on - so if you can use an int rather than a double it's generally going to be faster.
I can't immediately prove it, but I would imagine that if you modify the source of a JS implementation like Nashorn or V8 to remove int from the type lattice, you will find many programs run dramatically slower.