From 5a4c0d31ec767b7f960ceaec76c07c4cccc47483 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 11 Aug 2017 01:54:30 +0200 Subject: [PATCH] Do not ask for systempage everytime we load the page definition While rendering the sitemap we ask for the page definition. Previously we immediately returned an empty hash if the page is a `systempage?`. That causes two extra queries for each page we render. Instead we do not ask for `systempage?` anymore, because if the page definition can't be found we already return an emtpy hash. This speeds up rendering large sitemaps by about 6 times. --- app/models/alchemy/page/page_natures.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/alchemy/page/page_natures.rb b/app/models/alchemy/page/page_natures.rb index fc8b486194..518c356308 100644 --- a/app/models/alchemy/page/page_natures.rb +++ b/app/models/alchemy/page/page_natures.rb @@ -96,7 +96,6 @@ def status_title(status_type) # Returns the self#page_layout definition from config/alchemy/page_layouts.yml file. def definition - return {} if systempage? definition = PageLayout.get(page_layout) if definition.nil? log_warning "Page definition for `#{page_layout}` not found. Please check `page_layouts.yml` file."