I'm working on some updates to my Torid gem - and thinking about performance. I now have the situation where I have 2 implementations of the same function, one that is more performant when JIT is enabled, and one that is more performant, when JIT is not enabled.

Thoughts on how to manage this? Should I ship both with a load/parse time switch that detects if jit is enabled and then uses the right one? Just ship the jit one, just ship the base one?

#ruby #yjit #performance #rubyperformance

@copiousfreetime ship the JIT one, and tell people that the last version that’s faster without it is 1.3.0 or whatever in the readme. Time marches ever forward and makes monsters of us all
@copiousfreetime if implementing the switch is “cheap” so it with the switch. Having the burden of selecting the right green with the same name-ish is not something I’d lay on my users