4 ms·
The difference in speed has a lot more to do with memory layout. Javascript will never be as fast for this reason. You could make a JIT language as fast as C s
by Negitivefrags 8y ago
The difference in speed has a lot more to do with memory layout. Javascript will never be as fast for this reason.
You could make a JIT language as fast as C so long as it supported value types properly. Most programs in the "slow" languages spend most of their time chasing pointers around.
- goatlover 8y agoJulia comes fairly close.
- ChrisRackauckas 8y agoAnd Julia's tuples, named tuples, and structs are value-types without pointers.
- weberc2 8y agoTo elaborate on your point, its not just chasing pointers, it’s that those pointers point into random heap locations, each of which needs to be allocated individually and garbage collected. Also, because of the haphazard locations of these objects in the heap, you have way more cache misses than you would with value types.