Skip to content

Commit

Permalink
tl: don't run GC after every file
Browse files Browse the repository at this point in the history
As suggested by @virusdefender.

Closes #579.
  • Loading branch information
hishamhm committed Jul 21, 2023
1 parent f594c7e commit 710c081
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions tl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ do
end
end

local function check_collect(i)
if i % 50 == 0 then
collectgarbage()
end
end

local function printerr(s)
io.stderr:write(s .. "\n")
end
Expand Down Expand Up @@ -717,9 +723,7 @@ do
write_out(tlconfig, result, output_file)
end

if i > 1 then
collectgarbage()
end
check_collect(i)
end

local ok = report_all_errors(tlconfig, env)
Expand Down Expand Up @@ -1184,9 +1188,7 @@ commands["check"] = function(tlconfig, args)
end
end

if i > 1 then
collectgarbage()
end
check_collect(i)
end

local ok = report_all_errors(tlconfig, env)
Expand Down Expand Up @@ -1241,9 +1243,7 @@ commands["gen"] = function(tlconfig, args)
end

table.insert(results, res)
if i > 1 then
collectgarbage()
end
check_collect(i)
end

for _, res in ipairs(results) do
Expand Down Expand Up @@ -1343,9 +1343,7 @@ do
tr, trenv = tl.get_types(result, trenv)
end
end
if i > 1 then
collectgarbage()
end
check_collect(i)
end

local ok, _, _, w = report_all_errors(tlconfig, env)
Expand Down

0 comments on commit 710c081

Please sign in to comment.