lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:
Lua 5.1 (work4) is now available for testing at
        http://www.lua.org/work/lua-5.1-work4.tar.gz

Attached is a patch which tunes the new default GC tuneables
in accordance with my experiments in perf/peakmem tradeoff.
The usual disclaimers apply about basically optimizing for
a single app/engine... but hopefully this is nearer to the
sweet-spot for others too.

There's one outstanding GC issue which bothers me a bit: my
app's typical in-use mem figure (collectgarbage("count")) at
any given time is still approximately twice as large as it
'should' be.  I deduce this by performing a few 'full' GCs
in a row at random times and noticing that the in-use mem figure
drops to around 2500K rather than its usual 4400-4900K
range (though in several seconds it climbs back up into this
range).  I can't seem to alter this discrepancy at all by playing
with GCDIV, GCSWEEPMAX, GCSTEPMUL or GCSTEPSIZE.  I don't know
what would explain it.

Thanks,
--Adam
--
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3
Person who say it cannot be done should not interrupt person doing it.
-- Old Klingon Proverb
diff -ur lua-5.1-work4/src/lgc.c lua-5.1-work4-adam/src/lgc.c
--- lua-5.1-work4/src/lgc.c	Mon Dec 13 12:15:11 2004
+++ lua-5.1-work4-adam/src/lgc.c	Thu Dec 30 16:51:07 2004
@@ -27,7 +27,7 @@
 #define GCSWEEPMAX	10
 #define GCSWEEPCOST	30
 #define GCFINALIZECOST	100
-#define GCSTEPMUL	8
+#define GCSTEPMUL	2
 
 
 #define FIXEDMASK	bitmask(FIXEDBIT)
diff -ur lua-5.1-work4/src/lstate.c lua-5.1-work4-adam/src/lstate.c
--- lua-5.1-work4/src/lstate.c	Mon Dec 13 12:15:11 2004
+++ lua-5.1-work4-adam/src/lstate.c	Thu Dec 30 16:52:55 2004
@@ -193,7 +193,7 @@
   setnilvalue(gval(g->dummynode));
   gnext(g->dummynode) = NULL;
   g->totalbytes = sizeof(LG);
-  g->gcpace = GCDIV;
+  g->gcpace = 1 + 8/GCDIV;
   g->incgc = 1;
   if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {
     /* memory allocation error: free partial state */