ruby/ruby — pull request #89 by funny-falcon (2012-01-30 04:06:18+00:00)
Title: gc: increment heaps on lazy_sweep only if necessary

Too early call in `lazy_sweep` slows down sweep phase, cause while loop breaks on `if (has_free_object) { ... return TRUE;}` .

Heap expand in `gc_clear_mark_on_sweep_slots` unnecessary expands number of heaps, which slows down iterations in `rb_objspace_call_finalizer`, and `gc_marks` (cause we often need to binary search heap for pointer).

Testing suit: https://gist.github.com/1702301

Before:

$ sh siege.sh
Transaction rate:	114.71 trans/sec
Transaction rate:	117.84 trans/sec
Transaction rate:	121.62 trans/sec
$ sh siege.sh
Transaction rate:	114.71 trans/sec
Transaction rate:	117.84 trans/sec
Transaction rate:	121.62 trans/sec

After:

$ sh siege.sh
Transaction rate:	121.62 trans/sec
Transaction rate:	122.12 trans/sec
Transaction rate:	123.12 trans/sec
$ sh siege.sh
Transaction rate:	123.25 trans/sec
Transaction rate:	121.94 trans/sec
Transaction rate:	123.52 trans/sec