7c5a448f63
<% 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. |
||
---|---|---|
.. | ||
application | ||
categories | ||
common | ||
default | ||
embed | ||
exceptions | ||
invites | ||
layouts | ||
list | ||
pending_flags_mailer | ||
posts | ||
robots_txt | ||
search | ||
static | ||
topics | ||
user_notifications | ||
users |