[erlang-questions] Strange performance issue - advice needed

Ulf Wiger ulf@REDACTED
Sun Apr 15 08:40:01 CEST 2012


On 14 Apr 2012, at 21:56, Ian wrote:

> But, my goodness, so called buffered file IO is inexpressibly crap!

Well, it wasn't designed to eat large files from disk in a hurry. :)

What it shines at is distribution-transparent console I/O. You can do an RPC
to an embedded system from a shell on your workstation, and have the code
on the embedded system ask for input, without knowing that there is no 
console attached. The input and output will automatically be served by your 
shell. *

That is not crap.

BR,
Ulf W

* All this is actually default behavior, and easy to test. Start two nodes, e.g. node1
and node2, then from node1:

(node1@REDACTED)2> rpc:call(node2@REDACTED, io, get_line, ['>> ']).
>> foo
"foo\n"

The function io:get_line/1 is executed on node2, but the prompt appears on node1.

To verify that nothing fishy is happening, you can run an ad-hoc trace on node2:

Eshell V5.9  (abort with ^G)
(node2@REDACTED)1> dbg:tracer().
{ok,<0.44.0>}
(node2@REDACTED)2> dbg:tp(io,get_line,x).
{ok,[{matched,'node2@REDACTED',2},{saved,x}]}
(node2@REDACTED)3> dbg:p(new,[c]).  
{ok,[{matched,'node2@REDACTED',0}]}

(node2@REDACTED)4> (<0.51.0>) call io:get_line('>> ')
(<0.51.0>) returned from io:get_line/1 -> "foo\n"

dbg:stop().
ok


Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com






More information about the erlang-questions mailing list