4 ms·
I think this is a somewhat misleading title. It does not outperform C. This article appears to compare a suboptimal native C implementation to a JIT optimized
by starbugs 3y ago
I think this is a somewhat misleading title.
It does not outperform C.
This article appears to compare a suboptimal native C implementation to a JIT optimized version of some similar Ruby code. The JIT only outperforms that particular hand written C implementation in this case.
Still, great that the Riby JIT can do this now, but the title would be better phrased as ‘Ruby JIT in some cases outperforms suboptimal hand written C code‘. That wouldn’t be good clickbait though.
- deleted 3y ago[deleted]
- fasterik 3y agoYeah, it appears that in the original benchmark an off the shelf C parser outperformed an off the shelf Ruby parser. Then they wrote their own parser in Ruby, which was faster. But for a fair comparison, you should also write the same parser in C and compare it to that. It's possible that writing it in Ruby is preferable if it avoids FFI overhead and can do more aggressive inlining. But this doesn't seem like an apples to apples comparison.