[Ironruby-core] Code Review: SingletonOptimizations

Tomas Matousek Tomas.Matousek at microsoft.com
Fri Feb 12 00:54:18 EST 2010


  tfpt review "/shelveset:SingletonOptimizations;REDMOND\tomat"

Optimizes allocation of singletons. Module singletons could be allocated lazily. We used to eagerly allocate a singleton for each allocated RubyModule. This is only necessary for classes. Their singletons are chained in the inheritance hierarchy parallel to the hierarchy of the classes. A module doesn't have a super-class and thus we don't need to create a singleton for it unless it has some members. Consequently 2 modules of the same meta-module type with no singletons can share the same call-site rules. This sharing significantly improves RoR request time and reduces working set since the request processing code is using such modules.

Also fixes a few related minor bugs.

Previously:
	Initialized in 7.64449s
	10000 requests: 337 requests per second
	Peak working set: 216MB

Adaptively compiled:
	Initialized in 6.966271s
	10000 requests: 1132 requests per second
	Peak working set: 91MB

Compiled:
	Initialized in 26.106867s
	10000 requests: 1243 requests per second
	Peak working set: 89MB

MRI:
	Initialized in 2.82389s
	10000 requests: 1623 requests per second

Tomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: SingletonOptimizations.diff
Type: application/octet-stream
Size: 82586 bytes
Desc: SingletonOptimizations.diff
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100212/a0f66592/attachment-0001.obj>


More information about the Ironruby-core mailing list