discourse/app/views/layouts
Sam 7c5a448f63 PERF: remove 10-20ms of work from every page view
<%  s=Time.now;

main_app.categories_path
main_app.guidelines_path
main_app.tos_path
main_app.privacy_path

p (Time.now-s)*1000%>

Returns 10-20ms consistently on i7-4770k, on shared hosts the cost
could easily reach 40ms

This code simply calculates the strings

/categories
/guidelines
/tos
/privacy

It is ludicrous to spend this enormous amount of work just to calculate
4 strings.

I do not know if this is something specific about Discourse or a bug in
Rails (I tried without the main_app prefix and got similar results),
regardless we can got to avoid these _path APIs for now

Discovered this when running a flamegraph on our home page.
2016-01-21 22:43:56 +11:00
..
_head.html.erb FIX: stop rendering blank urls for icons 2015-10-02 10:12:58 +10:00
application.html.erb PERF: remove 10-20ms of work from every page view 2016-01-21 22:43:56 +11:00
crawler.html.erb PERF: remove 10-20ms of work from every page view 2016-01-21 22:43:56 +11:00
embed.html.erb Add page title and charset to embedded HTML 2015-09-18 16:12:56 -04:00
no_ember.html.erb FIX: footer was missing in some pages 2015-08-05 16:14:26 +02:00