This project is archived and is in readonly mode.
[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
-

Xavier Noria June 13th, 2009 @ 12:30 PM
+1 over here. This implementation is more efficient and still really clean, public interface is untouched, tests pass.
-

-

-

Repository June 13th, 2009 @ 10:06 PM
- State changed from new to committed
(from [9eeb5fed2ff8e781e56202f62b125bfadc486999]) Bytes calculation speed up
[#2800 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/9eeb5fed2ff8e781e56202f62b125b... -

Repository June 13th, 2009 @ 10:06 PM
(from [447d60e9ed015e5d6bd336323881f8180c2070d0]) Bytes calculation speed up
[#2800 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/447d60e9ed015e5d6bd336323881f8...
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
Tags
Referenced by
-
2800
[PATCH] Bytes calculation speed up for ActiveSupport
[#2800 state:committed]
-
2800
[PATCH] Bytes calculation speed up for ActiveSupport
[#2800 state:committed]