threaded GC for ruby enterprise edition

I’ve implemented what I believe to be a working “multi processed” GC for ruby enterprise edition.
ex:

time ree_straight gc_test/test_gc.rb
real    0m7.253s

time ree_threaded gc_test/test_gc.rb

real    0m4.975s

for file
GC.copy_on_write_friendly=true
a = []
1000000.times { a << []}
5000000.times {[]}

So it is indeed faster, at least on a 3.2Ghz dual core machine running linux.

it forks a worker process to go off and look for garbage. When done, the garbage is collected by the original thread [which was happily still running in the background].

It only turns on when you set copy_on_write_friendly=true.

You can see from the following results that both have the same total user time, but one has a smaller "real" time [total time spent], as it is moving processing speed onto the other core:


$ time ~/installs/ree_straight/bin/ruby gc_test/test_gc.rb

real    0m7.253s
user    0m7.120s
sys     0m0.112s


time ree_threaded gc_test/test_gc.rb

real    0m4.975s
user    0m7.040s
sys     0m0.452s

This is a prototype that doesn't work with weak hashes yet, nor GC.each_object. If there's interest I'll add that in.

Here's some other results:

however, with a lesser machine [dual core 1.6Ghz I believe]

time ./ree_threaded gc_test/test_gc.rb

real    0m6.513s
user    0m3.692s
sys     0m0.432s

$time ree_threaded gc_test/test_no_special_gc.rb

real    0m7.588s
user    0m3.708s
sys     0m0.084s

It didn't save as much.

Also the results for micro benchmarks currently show ree_threaded as being slower.

ree_threaded:
real-world/bm_hilbert_matrix.rb,0.708839178085327,0.726686000823975,0.728003978729248,0.721786975860596,0.724386930465698,0.721940612792969,0.006883876522767,20

ree_normal:
real-world/bm_hilbert_matrix.rb,0.656476974487305,0.666572093963623,0.669625997543335,0.670266151428223,0.667696952819824,0.666127634048462,0.005003227143205,20

# this a test from the ruby benchmark suite

Also an interesting result from the lloyd gc benchmarks:

ree_threaded:
arrays_read.rb time 0.167897
create_arrays_yaml.rb time 33.682916

ree_straight:
arrays_read.rb time 0.135281
create_arrays_yaml.rb time 16.222389

Slightly slower [perhaps because of increased startup time], and interesting to see one test take almost *exactly* twice as long. May be a bug in there.

The jury's out on whether it runs rails faster or not. My hunch is that it will.

Enjoy!

http://github.com/rogerdpack/rubyenterpriseedition/tree/gc_threaded

maven java woe

Exception in thread “main” java.lang.NoClassDefFoundError: org/xxx/yyy/LibraryManager
or
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/log4j/Logger

meant “you need to package that all up as a shaded jar” [or revamp your classpath to be better]

git mingw woe

C:\dev\rubyinstaller>”c:\Program Files\Git\bin”\git pull
0 [main] sh.exe” 3816 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump

C:\dev\rubyinstaller>
C:\dev\rubyinstaller>set PATH=”c:\Program Files\Git”\bin

C:\dev\rubyinstaller>git pull
fatal: unable to fork

C:\dev\rubyinstaller>”c:\Program Files\Git\bin”\git pull
Already up-to-date.

weird. very weird.

git version 1.5.6.1.1071.g76fb