<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">On Thu, Mar 25, 2021 at 1:14 PM Valentin Micic <<a href="mailto:v@micic.co.za">v@micic.co.za</a>> wrote:</span><br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div>Usually, when I use erlang:send_after/3, but no longer need the “ordered" event, I issue a corresponding erlang:cancel_timer/1 to stop this event from being raised.</div><div><br></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Correctness is also a player in this. For some protocols, you absolutely want the cancellation to be there in order to avoid a stale message, though they tend to be hard to completely avoid (because the timer expiration and message send happens before the cancel is executed. The window is small, but present).</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Another important point is the amount of timers you have running, and how quickly you start new timers. If your timer is for an hour, and you generate 100 timers a second, it runs up, quickly. It might be reasonably efficient to fire those timers into the void, but they also take up space while they are just sitting there.</div><br></div></div></div>