-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
In the process of memory profiling an application that uses Mongoid, ersatzryan and I discovered that Mongoid's threaded.rb is responsible for generating hundreds of thousands of new strings during our test case. In fact, Mongoid's own test suite generates 1,075,171 new strings just from threaded.rb.
Defining constant thread variable keys and memoizing stack keys drastically reduces the number of new strings allocated during typical usage, bringing the test suite total from 1,075,171 to 102.
We're also experiencing a ~4% increase in the speed of the test suite locally.