# HG changeset patch # User Kim Alvefur # Date 1431909949 -7200 # Node ID 07ceaf5f6f0d2f2f32e8a6646a2d6d4f50827379 # Parent 11f7fb2f927f71265e019d771df66e1291804161 mod_storage_xmlarchive: Optimize access to variables used in inner loop diff -r 11f7fb2f927f -r 07ceaf5f6f0d mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- 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;