ruby-on-rails – 性能问题:使用“link_to”还是“a”?

对于不需要太多控制器或选项的链接,使用html标签会更好吗?不必要地使用link_to rails标签会对性能产生任何影响吗?



这是专门讨论的,因为它与Rails助手in this article有关.根据文章:

A number of helpers in Rails core will run rather slowly. In general, all helpers that take a URL hash will invoke the routing module to generate the shortest URL referencing the underlying controller action. This implies that several routes in the route file need to be examined, which is a costly process, most of the time… For pages displaying a large number of links, I have measured speed improvements up to 200% (given everything else has been optimized).