From 66a0e3b9659a2bdec97e195c413993c38c420795 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 16 May 2026 17:10:03 -0700 Subject: [PATCH] Lazy-load res.items instead of caching entire table (~20MB savings) `items = res.items` at module level forces the entire Windower resource item database to materialize in memory (~20MB). This global is only used once (line 324) for a single item lookup when detecting item usage to pause following. Replace with direct `res.items[packet.Param]` access on demand. Cold lookup cost is ~0.2ms which is imperceptible for this infrequent event. Saves ~20MB RAM per client, ~120MB+ for multiboxers. --- FastFollow.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FastFollow.lua b/FastFollow.lua index 99f4f7e..db8e4d8 100644 --- a/FastFollow.lua +++ b/FastFollow.lua @@ -12,7 +12,7 @@ require('coroutine') packets = require('packets') res = require('resources') spells = require('spell_cast_times') -items = res.items +-- CKM: removed bulk assignment that materialized entire item DB (~20MB) config = require('config') texts = require('texts') require('logger') @@ -321,7 +321,7 @@ windower.register_event('outgoing chunk', function(id, original, modified, injec local packet = packets.parse('outgoing', modified) - local item = items[packet.Param] + local item = res.items[packet.Param] if not item or not item.cast_time then return end local cast_time = os.time()