Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] Bytes calculation speed up for ActiveSupport

#2800

The current bytes calculation is inefficient, because every time it instantiate a Fixnum (1024) and generates a lot of method calls. Example: if I call 16.gigabytes it internally invokes megabyte and kilobyte, instantiating three times 1024.

The number of internal calls and Fixnum instantiation is proportional to the order of magnitude of the called method: exabytes is more expensive than kilobytes.

I created a benchmark to compare the efficiency of the actual implementation, compared with my proposal: http://gist.github.com/129191

I attached a patch for this.

Cheers,
Luca

Reported by Luca Guidi · June 13th, 2009 @ 11:56 AM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none