-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/reimplement queries #80
Feature/reimplement queries #80
Conversation
Still has a logical error
Still have a logical error
Do you know the feeling where you wake up in the middle of the night, knowing exactly what you did wrong
Same for map(...).unwrap_or(..) to map_or(.., ..)
Based on a quick read:
|
At most this will be 7 * 7 copies of a 32 bit integer. DateTime |
I was looking into merging the functions and making a |
Shamefully, it seems that my logic was flawed. I ran a rudimentary benchmark: fn main() {
let expression = "0-59 * 0-23 ?/2 1,2-4 ? *";
let schedule = cron::Schedule::from_str(expression).unwrap();
let mut moment = Some(Utc.ymd(2017, 6, 15).and_hms(14, 29, 36));
let current_time = Instant::now();
let mut schedule_iterator = schedule.after(&moment.unwrap());
for _ in 0..1000_000 {
moment = schedule_iterator.next();
}
println!("Last moment: {:?} Time of exectution: {}", moment, current_time.elapsed().as_secs());
} And for my branch this was the output: That means, back to the drawing board for me. |
Thanks for taking the time to benchmark it, I definitely wasn't expecting a ~7x slowdown.
For what it's worth, I totally bought your reasoning. I didn't realize |
I think because it needs to retain 7 copies of each datetime due to iter::repeat. I might be able to find a solution with raw ordinals, but I'm putting that thought in the vault for now. If someone else feels the need to take on this challenge in the meantime, they're more than welcome to |
Closing as part of a cleanup, feel free to reopen. |
Current work for #77. Still a work in progress.
It has a logical errror I'm trying to fix. After that I'm looking into combining prev_from and next_after using an enum and some match clauses.