Skip to content

method_missing for helpers is slow #114

@gurgeous

Description

@gurgeous

Hi there, thanks for creating such a great project!

We noticed that a particular request in our Rails app was slow. Eventually we traced the problem to a decorator that was calling image_tag. Each call results in a method_missing through ActiveDecorator, which delegates to the view context. The overhead for each call is around 1ms, and we are calling image_tag 100 times, so the decorator was slowing down the page by 100ms.

Not sure about the proper fix. Can we mix in the helpers directly somehow, instead of relying on method_missing & view context? Should we call define_method to add missing methods as they are detected? Should we expose view_context and force decorators to call it directly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions