luagc: working incremental sweep via list truncation (5s -> 120ms worst)
Rootgc sweep chunked by temporarily NULLing a next pointer and calling the original lua_gc_remove_objects on the truncated sublist. Swept survivors are detached to a separate list to prevent re-sweeping. Lists reconnected after final chunk. Birth-mark via binary patch of luaC_link immediate byte (0x6F7B37) ensures new objects born during sweep survive. Profiling shows sweep chunks at 0-9ms each (was 225ms avg, 5s worst). Remaining bottleneck: atomic mark (80ms) + udata/string sweep (44-92ms).
This commit is contained in:
@@ -329,8 +329,8 @@ pub fn installHooks() void {
|
||||
// Lua slab allocator replacement
|
||||
// installed += luaalloc.install(); // disabled for testing
|
||||
|
||||
// Incremental GC -- disabled, needs more research
|
||||
// installed += luagc.install();
|
||||
// GC phase profiler
|
||||
installed += luagc.install();
|
||||
}
|
||||
|
||||
pub fn lateInit() void {
|
||||
@@ -340,7 +340,8 @@ pub fn lateInit() void {
|
||||
|
||||
pub fn removeHooks() void {
|
||||
if (g_is_hook_owner) {
|
||||
luaalloc.dumpStats(); // dump size histogram before unhooking
|
||||
luaalloc.dumpStats();
|
||||
luagc.dumpStats();
|
||||
filecache.remove();
|
||||
inflate_hook.remove();
|
||||
transform_hook.detach();
|
||||
|
||||
Reference in New Issue
Block a user