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.

ActiveSupport::TimeWithZone in Range performance bug

#6779

We discovered that some operations on the Range class of ActiveSupport::TimeWithZone is slow.

Example:

(10.days.ago..3.days.ago).min

Will have more than 5 seconds execution time with both Rails 2.3.11 and 3.0.7 on Ruby 1.8.7.
The problem don't appear on Ruby 1.9.2.

Also the following code doesn't have performance issue:

(10.days.ago.to_datetime..3.days.ago.to_datetime).min

Thanks,
Bogdan

Reported by Bogdan Gusiev · May 13th, 2011 @ 08:28 AM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. nmunson
    nmunson

    I can confirm it happens on Ruby 1.8.7 and Rails 3.0.0, the example line takes 10+ seconds to run. The "doesn't have an issue" code works instantly as it did for you as well.

    May 14th, 2011 @ 06:03 AM

  2. debosh
    debosh

    I can also confirm.

    I've found the bug and I'm creating patch.

    May 15th, 2011 @ 10:32 AM