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. >>i hope all th
by marktangotango 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.
>>i hope all that heroism and effort has a good reason for it beside just being a great/interesting engineering endeavor.
Indeed, the amount effort put into optimizing dynamic languages boggles the mind, particularly on the jvm (including all the work on invoke dynamic).
- 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.
- tracker1 12y agoA lot of JavaScript optimizations use 32-bit ints internally, specifically bitwise operations will truncate to a 32-bit value before performing any such operations... not to mention improved cpu overhead and benefits from the asm.js subset.
- pjmlp 12y ago> Indeed, the amount effort put into optimizing dynamic languages boggles the mind It is actually quite interesting, given that was the research in optimizing Lisp and Smalltalk runtimes that gave birth to JIT compilers and many of their techniques. What I find sad is the effort being spent in JavaScript, instead of more optimizer friendly languages like Lisp and Dylan. But that is what we got in mainstream languages and why I am following Julia's progress.