2 ms·
V8 seems to go through a lot of hoops just to avoid NaN boxing like JSC and Spider Monkey
by jacobp100 2y ago
V8 seems to go through a lot of hoops just to avoid NaN boxing like JSC and Spider Monkey
- hyperhello 2y agoI was playing with Nan boxing recently. There are caveats like whether you can init a floating point Nan in immediate mode and how to do compares on the data. Basically it seems like you have to be ready to do most things with a two step process and cost yourself a cycle now and then.
- jacobp100 2y agoYeah but with JS you’re already miles away from that sort of instruction-level efficiency. For example, if it’s a object, you have to try and coerce it to a number
- hyperhello 2y agoIf it’s an object and you want it to be a number, you’re going to have to chug through that in any programming environment. JS interpreters are capable of inferring that variables will be numbers throughout code. A lot of what people say against JavaScript they already said against Java, it’s recycled.