discourse/app
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
..
assets FIX: remove green background for wiki (this can be re-added via a customization if needed) 2016-01-21 11:46:53 +01:00
controllers FIX: enabling suppress_from_homepage should only remove the category from the homepage 2016-01-20 17:55:58 +01:00
helpers add Twitter labels only if both properties are present 2016-01-07 16:48:05 +05:30
jobs FEATURE: better email in support 2016-01-19 00:57:55 +01:00
mailers Unsubscribe via email 2016-01-20 22:25:25 +13:00
models FEATURE: make top criteria formula multipliers controlled by site 2016-01-21 10:30:06 +05:30
serializers Merge pull request #3920 from tgxworld/fix_onebox_emoji 2016-01-20 15:38:12 +01:00
services FEATURE: better email in support 2016-01-19 00:57:55 +01:00
views PERF: remove 10-20ms of work from every page view 2016-01-21 22:43:56 +11:00