yjit-bench icon indicating copy to clipboard operation
yjit-bench copied to clipboard

Idea: benchmark JITs against fast_blank

Open tekknolagi opened this issue 1 month ago • 2 comments

We're likely not going to get the full perf but I wonder how much closer we get by enabling a JIT

https://github.com/SamSaffron/fast_blank

tekknolagi avatar Oct 29 '25 15:10 tekknolagi

From a quick look at https://github.com/SamSaffron/fast_blank/blob/d1695581e397b0b00fb589edae0dec99ce846e42/benchmark#L8-L14 it would probably be mostly dominated by Regexp. BTW these should probably use .match? and not ===, it's old code.

The current blank? in Rails is https://github.com/rails/rails/blob/a2cad831932ceb1e025f75f17b1d3b90a143dc86/activesupport/lib/active_support/core_ext/object/blank.rb#L153-L163 (uses match?).

I think it'd still be interesting to have in this benchmark suite though.

(I'd be curious how TruffleRuby & TRegex perform on it, since that would then inline the Regexp logic in the same compilation.)

eregon avatar Oct 29 '25 15:10 eregon

I am curious about the actual distribution of strings in various large applications. If they skew more empty than whitespace-filled, we can inline the empty? call pretty well. If they skew more whitespace-filled, the gem helps a lot.

tekknolagi avatar Oct 29 '25 20:10 tekknolagi