Re: Optimise io requests for long message queues
Henrik Nord <[email protected]> Wed, 17 Sep 2014 12:30:49 +0200
| Newsgroups | gmane.comp.lang.erlang.patches |
|---|---|
| Message-ID | <[email protected]> |
On 2014-06-27 19:07, Magnus Henoch wrote: > 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 > _______________________________________________ > erlang-patches mailing list > [email protected] > http://erlang.org/mailman/listinfo/erlang-patches Hi! we would like a test case which ensures that the optimization is not broken: An example of such test can be found in gen_server_SUITE:call_with_huge_message_queue The documentation needs a minor fix in the part that talks about "a more complicated client" - maybe something similar to this: "The io module monitors the I/O server, and uses the monitor reference as the ReplyAs datum. A more complicated client could have several outstanding I/O requests to the same I/O server and would then use different references (or something else) to differentiate among the incoming IO replies." When you have addressed the issues above could you also create a pull-request for this? -- /Henrik Nord Erlang/OTP _______________________________________________ erlang-patches mailing list [email protected] http://erlang.org/mailman/listinfo/erlang-patches