3 ms·
This explains everything. BTW does float=>int conversion a lot in JS other than the implicit 32bit bitwise operation?
by kbumsik 8y ago
This explains everything. BTW does float=>int conversion a lot in JS other than the implicit 32bit bitwise operation?
- olliej 8y agoit really does not - if you’re running js that spends enough time doing double->integer conversion that that is a major bottleneck you might get some win. The instruction is not intrinsically faster than a regular float->integer conversion, the only real changes are to behavior around sentinel values. The biggest cost in floating point to integer conversion is the conversion itself, not handling of edge cases. In reality the big win from this instruction is not performance, it’s code size. So no, this instruction does not explain 40% perf improvement. It’s very easy to see why: for it to be a 40% (or any significant %) win your code would already have to be spending at least 40% of the time doing just double to int conversions. Not even micro benchmarks manage that level of insanity.
- olliej 8y agoOoh follow on demonstrating that this instruction is not making js faster: JSC does not currently emit that instruction. So given it’s never used it seems unlikely to be the reason.