mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
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.
42 lines
1.7 KiB
Text
42 lines
1.7 KiB
Text
<!DOCTYPE html>
|
|
<html lang="<%= SiteSetting.default_locale %>">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title><%= content_for?(:title) ? yield(:title) + ' - ' + SiteSetting.title : SiteSetting.title %></title>
|
|
<meta name="description" content="<%= @description_meta || SiteSetting.site_description %>">
|
|
<%= render partial: "layouts/head" %>
|
|
<%- unless customization_disabled? %>
|
|
<%= raw SiteCustomization.custom_head_tag(session[:preview_style]) %>
|
|
<%- end %>
|
|
<%= render_google_universal_analytics_code %>
|
|
<%= yield :head %>
|
|
<style>
|
|
img { max-width: 100%; width: auto; height: auto; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<%- unless customization_disabled? %>
|
|
<%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
|
<%- end %>
|
|
<header>
|
|
<a href="<%= path "/" %>"><img src="<%=SiteSetting.logo_url%>" alt="<%=SiteSetting.title%>" id="site-logo"></a>
|
|
</header>
|
|
<div id="main-outlet" class="wrap">
|
|
<%= yield %>
|
|
</div>
|
|
<footer class="container">
|
|
<nav itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
|
<a href='<%= path "/" %>'><%= t 'home_title' %></a>
|
|
<%= link_to t('js.filters.categories.title'), path("/categories") %>
|
|
<%= link_to t('guidelines_topic.title'), path("/guidelines") %>
|
|
<%= link_to t('tos_topic.title'), path("/tos") %>
|
|
<%= link_to t('privacy_topic.title'), path("privacy") %>
|
|
</nav>
|
|
<p><%= t 'powered_by_html' %></p>
|
|
</footer>
|
|
<%= render_google_analytics_code %>
|
|
<%- unless customization_disabled? %>
|
|
<%= raw SiteCustomization.custom_body_tag(session[:preview_style]) %>
|
|
<%- end %>
|
|
</body>
|
|
</html>
|