String#=~ faster than String#match by schneems · Pull Request #59 · fastruby/fast-ruby

Skip to content

Navigation Menu

Sign in

Appearance settings

Conversation

schneems referenced this pull request in schneems/rails

Aug 6, 2015
In `apply_inflections` a string is down cased and some whitespace stripped in the front (which allocate strings). This would normally be fine, however `uncountables` is a fairly small array (10 elements out of the box) and this method gets called a TON. Instead we can keep an array of valid regexes for each uncountable so we don't have to allocate new strings.

This change buys us 325,106 bytes of memory and 3,251 fewer objects per request.

JuanitoFatas added a commit that referenced this pull request

Aug 7, 2015
String#=~ faster than String#match

schneems added a commit to schneems/rails that referenced this pull request

Aug 7, 2015