constants.rb

Path: merb-core/lib/merb-core/constants.rb
Last Update: Tue Jul 28 08:32:52 +0200 2009

Most of this list is simply constants frozen for efficiency and lowered memory consumption. Every time Ruby VM comes across a string or a number or a regexp literal, new object is created.

This means if you refer to the same string 6 times per request and your application takes 100 requests per second, there are 600 objects for weak MRI garbage collector to work on.

GC cycles take up to 80% (!) time of request processing in some cases. Eventually Rubinius and maybe MRI 2.0 gonna improve this situation but at the moment, all commonly used strings, regexp and numbers used as constants so no extra objects created and VM just operates pointers.

[Validate]