This project is archived and is in readonly mode.

#2800 ✓committed
Luca Guidi

[PATCH] Bytes calculation speed up for ActiveSupport

Reported by Luca Guidi | June 13th, 2009 @ 11:56 AM | in 2.x

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

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages