What is "cheaper"?

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Thu Mar 25 15:22:01 CET 2021


On Thu, Mar 25, 2021 at 1:14 PM Valentin Micic <v@REDACTED> wrote:

> 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.
>
>
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).

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210325/8e7f00c3/attachment.htm>


More information about the erlang-questions mailing list