Back in the day I implemented a patch for the inflector that gave (iirc)
something like 10x improvement. It was based on the Merb inflector, and was
mostly accomplished by more aggressive caching. My argument at the time was
that inflections tend to be used over and over again in a given app (mostly
by the router).

It required some back-compat breakage, and since the inflector isn't a
large cost even in tiny API-like requests, we dropped it.

Yehuda Katz
(ph) 718.877.1325


On Sun, Feb 12, 2012 at 2:25 PM, Xavier Noria <[email protected]> wrote:

> OK, the alternation is a red herring.
>
> I have a patch with the new approach implemented and have compared
> runtimes: no difference, there's no speedup.
>
> The 6x speedup in the proof of concept happens because the script is
> not doing this apparently innocent check over the default 9
> uncountable words:
>
>      inflections.uncountables.any? { |inflection| result =~
> /\b#{inflection}\Z/i }
>
> which is present in ActiveSupport::Inflections#apply_inflections.
>
> In that method, if you return the inflection right way instead of
> doing this check, you see the 6x.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to