Re: Set::Infinite backtrack too deep from DateTime::Set
2007/2/5, Joshua ben Jore [EMAIL PROTECTED]: I'm using DateTime::Set to encode a radio station's program lineup. It's about 170 weekly recurrences that are all mostly about an hour apart. Set::Infinite can't optimize this query, so it's actually making 170 or more calls to Recurrence and comparing them. You could get a big optimization by combining several recurrences into a single set, like: my $set = DateTime::Event::Recurrence-weekly( days = [ 2, 4 ], hours = [ 10, 14, -1 ], minutes = [ 15, 30, -15 ] ); - Flavio S. Glock
Set::Infinite backtrack too deep from DateTime::Set
I'm using DateTime::Set to encode a radio station's program lineup. It's about 170 weekly recurrences that are all mostly about an hour apart. If I try to find the current event it's really slow and I get a pile of warnings from Set::Infinite. I can get the warnings to go away if I set $Set::Infinite::max_backtrack_depth to 52. I can get semi-reasonable performance for the -current call if I restrict the set being queried to only the recent past. The warning: Set::Infinite: Backtrack too deep (more than 10 levels) at /home/josh/bin/perl/5.8.8/lib/site_perl/5.8.8/DateTime/Set.pm line 535 I'm hoping someone here can suggest a better way to do this, get better performance from the -current query, avoid having to manually guess the range I'll find an answer in, and what's the deal with the warnings. # Look up whatever is current for a date/time. $THE_DATE = ... $all_events = DateTime::Set-empty_set-set_time_zone( 'US/Central' ) for ( ... ) $all_events = $all_events-union( DateTime::Event::Recurrence -weekly( %$_ ) -set_time_zone( 'US/Central' ) ) local $Set::Infinite::max_backtrack_depth = 52 # Set::Infinite, shut up! # Restrict $all_events to only the recent past because this makes the query faster $recent_past = $all_events-intersection( DateTime::Span-from_datetimes( from = $THE_DATE-clone-subtract( hours = 4 )-truncate( to = 'hour' ), end = $THE_DATE ) ) $CURRENT = $recent_past-current( $THE_DATE ) Josh