From 5a403ed70396c46f04b1389ed1e0ed48b694075c Mon Sep 17 00:00:00 2001 From: Jude Melton-Houghton Date: Fri, 9 Dec 2022 19:09:03 -0500 Subject: [PATCH] Make FPGA cache max age configurable --- mesecons_fpga/init.lua | 3 ++- settingtypes.txt | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mesecons_fpga/init.lua b/mesecons_fpga/init.lua index 70bca1c..a53fe83 100644 --- a/mesecons_fpga/init.lua +++ b/mesecons_fpga/init.lua @@ -330,9 +330,10 @@ plg.compile_with_cache = function(instr) end -- Entries are removed from the cache if they are unused for at least a minute. +local compile_cache_max_age = mesecon.setting("fpga_cache_max_age", 1) local function clean_compile_cache() for instr, entry in pairs(compile_cache) do - if entry.age < 1 then + if entry.age < compile_cache_max_age then entry.age = entry.age + 1 else compile_cache[instr] = nil diff --git a/settingtypes.txt b/settingtypes.txt index 5627440..429bc0c 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -17,6 +17,12 @@ mesecon.detector_radius (Player detector scanning radius) int 6 3 16 mesecon.node_detector_distance_max (Node detector distance limit) int 10 1 16 +[mesecons_fpga] + +# The minimum time in minutes that unused cached FPGA configurations will be kept around. +mesecon.fpga_cache_max_age (Compile cache max age) int 1 0 10 + + [mesecons_luacontroller] mesecon.luacontroller_string_rep_max (string:rep result length limit) int 64000 1000 1000000