From: Kurt Stephens Date: 2011-07-19T22:50:25+09:00 Subject: [ruby-core:38193] [Ruby 1.9 - Feature #5033] PATCH: 1.9: gc_mark_children: Avoid gc_mark() tail recursion, use goto again. Issue #5033 has been updated by Kurt Stephens. I don't know of a reliable means to record max stack depth, but the speed isn't necessarily better or worse: > bash ./profile-gc-mark + export 'CFLAGS=-O2 -I/opt/local/include' LDFLAGS=-L/opt/local/lib + CFLAGS='-O2 -I/opt/local/include' + LDFLAGS=-L/opt/local/lib + for branch in trunk trunk-gc-mark-optimization + git checkout trunk Switched to branch 'trunk' Your branch is ahead of 'origin/trunk' by 10 commits. + prefix=/Users/stephens/local/ruby-trunk + make test + make test real 0m51.808s user 0m19.760s sys 0m13.118s + make test real 0m49.938s user 0m19.598s sys 0m13.396s + for branch in trunk trunk-gc-mark-optimization + git checkout trunk-gc-mark-optimization Switched to branch 'trunk-gc-mark-optimization' + prefix=/Users/stephens/local/ruby-trunk-gc-mark-optimization + make test + make test real 0m51.752s user 0m19.526s sys 0m13.336s + make test real 0m50.157s user 0m19.735s sys 0m13.487s BTW: make test-all in trunk hangs for me on OS X 64. The space improvements would occur for NODES with deep obj->as.node.u3.node, arrays with deep last elements, and OBJECTS where the last IVAR is deep. obj->as.file.fptr->write_lock, obj->as.regexp.src, obj->as.match.str, obj->as.rational.den, obj->as.complex.imag are likely to be not deep. So maybe this patch is pointless, except for the removal of the unnecessary "long i" variable in the T_OBJECT case/loop. ---------------------------------------- Feature #5033: PATCH: 1.9: gc_mark_children: Avoid gc_mark() tail recursion, use goto again. http://redmine.ruby-lang.org/issues/5033 Author: Kurt Stephens Status: Assigned Priority: Normal Assignee: Narihiro Nakamura Category: core Target version: 1.9.x Minor GC improvement. Avoid recurring into gc_mark() when "goto again;" is sufficient. -- KAS -- http://redmine.ruby-lang.org