> upcase seems VERY compelling in a micro benchmark since it can
> go straight into opt_case_dispatch. But I worry the extra
> garbage might have a different effect in a real app, especially
> with more headers.
It is indeed debatable. The thing is that on match, that Regexp
will generate a MatchData and a garbage string. So I'd think
the extra GC pressure would be totally negligible.
But I agree it's hard to tell without a larger more representative benchmark.
> Maybe:
>
> (val || ''.freeze).include?("\n".freeze)
>
> Can work for those buggy apps, though...
Yes. or:
vall && val.include?...