Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
multi: mandate use "expire ID" for timers #1472
[internals only, no user-visible change]
This allows us to remove running timers without having them expire "in vain". It makes the typical list of "running timers" much shorter (now usually just 0-2 entries, from previously when it could easily grow to 6-10). It then also allows us to use a fixed array of possible timers so we can do them without using malloc.
A) reduces the timeout lists drastically B) prevents a lot of superfluous loops for timers that expires "in vain" when it has actually already been extended to fire later on
... since the total amount is low this is faster, easier and reduces memory overhead. Also, Curl_expire_done() can now mark an expire timeout as done so that it never times out.
I have a question about this change. I have only dug into the code a little, so this could be a silly question.
The timers all now have IDs, so you now have a fixed set of timer "categories".
If we need to test for something (eg speedtest), the code calls
In code... something like... hmm... make up a scenario....
I suggest that Curl_expire_latest become simply Curl_expire(id), and always adjust the timer.
Without digging into the code any more, I would guess that this will not affect performance, because (in my scenario) task1 and task2 are going to be called no matter what timer goes off (my assumption at the top).
Thanks a lot for your valuable thoughts and feedback. Yes I can totally see how you're right and that this change sort of "broke" Curl_expire_latest() for exactly the reasons you state. I intend to proceed as you suggest and replace Curl_expire_latest() with plain Curl_expire()... Thanks again. I'll follow up with a separate PR.