I have the following code being a huge bottleneck:
io.contents("dict." .. lang .. ".json", dicts[lang] |> json.encode|true|)
I've tried to address this in #877, and while that was a huge boost, it still takes several minutes (with the amount of data I'm processing).
Using the following Lua code, it instead only takes a couple of seconds:
local t = { "{\n" }
local first = true
for ipairs(dicts[lang].__order) as key do
if first then
first = false
else
t:insert(",\n")
end
t:insert(" "..json.encode(key)..": "..json.encode(dicts[lang][key]))
end
t:insert("\n}")
io.contents("dict." .. lang .. ".json", t:concat(""))
This is only an issue with __order, so this should be special-cased some more, ideally to behave similarly to the above Lua code.
I have the following code being a huge bottleneck:
I've tried to address this in #877, and while that was a huge boost, it still takes several minutes (with the amount of data I'm processing).
Using the following Lua code, it instead only takes a couple of seconds:
This is only an issue with
__order
, so this should be special-cased some more, ideally to behave similarly to the above Lua code.