Ruby 2.4 introduces `Array#sum`, but it only supports numeric elements, breaking our `Enumerable#sum` which supports arbitrary `Object#+`. To fix, override `Array#sum` with our compatible implementation. Native Ruby 2.4: %w[ a b ].sum # => TypeError: String can't be coerced into Fixnum With `Enumerable#sum` shim: %w[ a b ].sum # => 'ab' We tried shimming the fast path and falling back to the compatible path if it fails, but that ends up slower even in simple causes due to the cost of exception handling. Our only choice is to override the native `Array#sum` with our `Enumerable#sum`.
BigDecimal('an invalid string') has changed its behavior to raise an ArgumentError since 1.3.0 https://bugs.ruby-lang.org/issues/10286
I guess we're only behaving differently (either potentially slower, or potentially cachier, or both) if the configured
Nearly zero - there's still the overhead of checking the config option at runtime. We could change it so that we rewrite the method at boot time, I guess.
As for backporting I think we should be able to do it fairly cleanly - IIRC there's a couple of gotchas but I can have a look at it this week.