lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
>> Can you recommend any parameter changes to make the 5.2 garbage
>> collector more "5.1-like"?
>
> To make the collector more agressive you must increase its stepmul.
> By how much I do not know (see below).

I tried a bunch of values for "stepmul", from the default (200) up to
10,000...  But none of the stepmul values I tried seemed to make much
difference -- Lua 5.2 never seemed able to keep the memory usage under
control (it still used over twice as much memory as 5.1.4 or LuaJIT,
and caused the system to start thrashing).

It is clear that there's garbage available to collect:  I tried adding
some explicit calls to "collectgarbage" in strategic locations, and
that _did_ dramatically reduce the memory usage in 5.2, although it
still never got as low as Lua 5.1.4 or LuaJIT (even .

For my personal use, the explicit calls to collectgarbage basically
suffice to keep things under control.  However it does seem kind of
worrying that Lua 5.2's GC is unable to ever reclaim the garbage which
is obviously there, and lets things get so far out of hand...

Thanks,

-miles


* Benchmark data:


Using no explicit calls to "collectgarbage":

Lua variant             Scene def CPU           Total CPU     Elapsed   MaxRSS
------------------------------------------------------------------------------
* stepmul = 200
luajit2.0.0-beta9  115.5~0.9s (+4.3s)  119.4~1.0s (+4.5s)  124.8~3.8s  1,626MB
lua5.1.4           134.9~2.3s (+2.5s)  138.9~2.4s (+2.7s)  141.9~2.6s  1,653MB
lua5.2.0           134.1~0.9s (+8.0s)  143.9~1.0s (+9.0s)  237.9~7.5s  3,359MB
lua5.2.1-work1     132.6~1.1s (+8.0s)  142.2~1.1s (+9.0s)  233.3~5.3s  3,366MB
* stepmul = 500
luajit2.0.0-beta9  115.4~0.8s (+4.1s)  119.2~0.8s (+4.3s)  124.6~3.8s  1,626MB
lua5.1.4           134.4~1.9s (+2.4s)  138.3~1.9s (+2.5s)  141.0~1.9s  1,749MB
lua5.2.0           131.5~0.8s (+8.0s) 142.8~0.8s (+10.5s) 288.3~15.5s  3,364MB
lua5.2.1-work1     130.6~1.0s (+7.8s) 141.7~0.9s (+10.4s) 295.4~16.3s  3,362MB
* stepmul = 1,000
luajit2.0.0-beta9  115.3~0.7s (+4.0s)  119.1~0.8s (+4.2s)  123.5~0.8s  1,626MB
lua5.1.4           134.9~2.8s (+2.4s)  138.8~2.9s (+2.5s)  141.4~2.9s  1,712MB
lua5.2.0           132.1~1.1s (+8.0s) 143.2~1.0s (+10.4s)  285.8~8.3s  3,354MB
lua5.2.1-work1     130.9~1.2s (+8.0s) 141.6~1.3s (+10.4s) 296.8~22.5s  3,360MB
* stepmul = 2,500
luajit2.0.0-beta9  115.4~0.6s (+4.1s)  119.2~0.6s (+4.3s)  123.6~0.6s  1,626MB
lua5.1.4           136.0~2.0s (+2.5s)  139.9~2.0s (+2.6s)  142.7~2.0s  1,625MB
lua5.2.0           133.6~0.8s (+8.3s)  144.5~0.7s (+9.9s) 282.1~15.8s  3,342MB
lua5.2.1-work1     132.1~1.2s (+8.0s)  142.9~1.2s (+9.6s) 279.8~14.3s  3,353MB
* stepmul = 10,000
luajit2.0.0-beta9  116.7~0.7s (+4.3s)  120.8~0.8s (+4.5s)  128.2~2.8s  1,626MB
lua5.1.4           137.7~2.0s (+2.7s)  142.0~2.0s (+2.8s)  147.1~2.7s  1,627MB
lua5.2.0           132.2~1.7s (+7.8s) 143.4~1.9s (+10.2s) 290.4~36.9s  3,349MB
lua5.2.1-work1     132.5~3.5s (+8.4s) 143.9~3.8s (+10.9s) 325.8~95.4s  3,330MB

* 10 samples
* CPU times are in the form "user (+sys)"; standard deviation follows "~"


Adding explicit calls to "collectgarbage" at a couple of strategic points:

Lua variant             Scene def CPU           Total CPU     Elapsed   MaxRSS
------------------------------------------------------------------------------
* stepmul = 200
luajit2.0.0-beta9  116.2~0.8s (+3.9s)  120.1~0.9s (+4.1s)  124.5~1.1s  1,581MB
lua5.1.4           133.4~1.2s (+2.3s)  137.3~1.2s (+2.5s)  140.0~1.2s  1,683MB
lua5.2.0           125.5~0.9s (+3.1s)  129.5~0.9s (+3.2s)  134.6~1.2s  1,995MB
lua5.2.1-work1     124.4~0.6s (+3.1s)  128.5~0.5s (+3.2s)  133.3~0.4s  1,995MB
* stepmul = 500
luajit2.0.0-beta9  118.0~1.1s (+4.1s)  122.0~1.1s (+4.3s)  128.6~5.0s  1,570MB
lua5.1.4           136.4~1.6s (+2.5s)  140.6~1.6s (+2.6s)  145.4~2.3s  1,610MB
lua5.2.0           128.3~1.1s (+2.8s)  132.5~1.1s (+3.0s)  142.9~3.4s  2,046MB
lua5.2.1-work1     126.0~0.9s (+3.2s)  130.5~0.8s (+3.4s)  140.8~2.4s  1,999MB
* stepmul = 1,000
luajit2.0.0-beta9  117.2~0.6s (+4.0s)  121.1~0.6s (+4.2s)  125.5~0.6s  1,569MB
lua5.1.4           135.8~1.9s (+2.4s)  139.8~2.0s (+2.6s)  142.5~1.9s  1,605MB
lua5.2.0           126.5~1.3s (+3.0s)  130.6~1.3s (+3.1s)  135.1~2.2s  1,875MB
lua5.2.1-work1     124.7~0.9s (+2.9s)  128.8~1.0s (+3.0s)  132.2~1.1s  1,875MB
* stepmul = 2,500
luajit2.0.0-beta9  116.1~0.6s (+3.9s)  120.0~0.7s (+4.1s)  124.4~0.9s  1,566MB
lua5.1.4           135.7~1.6s (+2.4s)  139.6~1.6s (+2.5s)  142.3~1.6s  1,590MB
lua5.2.0           124.2~0.8s (+2.9s)  128.0~0.8s (+3.1s)  131.3~0.8s  1,885MB
lua5.2.1-work1     123.4~0.9s (+3.0s)  127.2~0.9s (+3.2s)  130.6~0.9s  1,884MB
* stepmul = 10,00
luajit2.0.0-beta9  115.5~1.0s (+4.1s)  119.3~1.1s (+4.3s)  124.7~3.8s  1,566MB
lua5.1.4           134.5~1.8s (+2.4s)  138.4~1.8s (+2.5s)  141.1~1.8s  1,582MB
lua5.2.0           124.3~0.9s (+3.0s)  128.3~1.0s (+3.1s)  131.5~0.9s  2,067MB
lua5.2.1-work1     123.4~1.0s (+2.9s)  127.4~1.1s (+3.1s)  130.6~1.1s  2,067MB

-- 
Patience, n. A minor form of despair, disguised as a virtue.