Justin C. wrote:
Is there any performance difference between rendering partials vs.
calling a helper? When we initally started coding we built a bunch of
Partials are just using the builtin ERB module that comes with Ruby. It
has to read in the template file, parse the ERB and generate ruby, then
eval the entire thing vs. just executing a function…
So if you really want to get to the nitty gritty partials should be
slower. You would have to do performance tests to find out how much.
That being said, this sounds like premature optimization to me. If your
performance tests tell you that you need to make your view render faster
then maybe consider doing this. But there are probably other ways to
increase performance that will deliver better results and keep your code
maintainable. When deciding between partials and helpers just figure out
what is the most maintainable. Only if you can measure a performance
problem should you make a decision to do something in a less
maintainable way. Otherwise you are just guessing and making your code