[erlang-patches] Optimise io requests for long message queues

Magnus Henoch magnus@REDACTED
Fri Jun 27 19:07:03 CEST 2014


This patch reduces the run time of non-raw I/O when the calling process
has a long message queue, by using the monitor reference to trigger the
selective receive optimisation.

Here is a little test program:
https://gist.github.com/legoscia/e0ac1bd1f640c9489609

Without my change, the run time of the call to file:write/2 increases as
the message queue length increases, while with my patch, the run time
stays constant.

I was a bit unsure about removing the 'EXIT' clause from the receive,
but I've mostly convinced myself that this case should be fully handled
by the 'DOWN' clause, as the process in question is being monitored.

git fetch git://github.com/legoscia/otp.git io-message-queue-optimisation

https://github.com/legoscia/otp/compare/legoscia:io-message-queue-optimisation
https://github.com/legoscia/otp/compare/legoscia:io-message-queue-optimisation.patch

Regards,
Magnus



More information about the erlang-patches mailing list