Changeset

1741:07ceaf5f6f0d

mod_storage_xmlarchive: Optimize access to variables used in inner loop
author Kim Alvefur <zash@zash.se>
date Mon, 18 May 2015 02:45:49 +0200
parents 1740:11f7fb2f927f
children 1742:ec50cecc9318
files mod_storage_xmlarchive/mod_storage_xmlarchive.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Mon May 18 02:44:41 2015 +0200
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Mon May 18 02:45:49 2015 +0200
@@ -129,16 +129,18 @@
 				end
 			end
 
+			local q_with, q_start, q_end = query.with, query.start, query["end"];
 			for i = first_item, last_item, step do
 				local item = items[i];
+				local i_when, i_with = item.when, item.with;
 				if not item then
 					module:log("warn", "data[%q][%d] is nil", dates[d], i);
 					break;
 				end
 				if xmlfile and in_range
-				and (not query.with or item.with == query.with)
-				and (not query.start or item.when >= query.start)
-				and (not query["end"] or item.when <= query["end"]) then
+				and (not q_with or i_with == q_with)
+				and (not q_start or i_when >= q_start)
+				and (not q_end or i_when <= q_end) then
 					count = count + 1;
 					first_item = i + step;