Erlang port speed
Fri May 29 18:04:46 CEST 2009
I have a very simple "ping-pong" test set up between Erlang and a C# port.
The C# program used for the Port can also be run standalone in "master" mode
so that a master and slave instance of the C# program can ping-pong between
themselves over stdin/stdout.
It's a stream Port, if that matters.
All I'm doing is sending a pre-computed list I create only once via
binary_to_list(<<"Ping!\n">>) to Port and then wait to receive any response,
then repeat X times.
Ping-ponging 1 million times takes about 160 seconds between Erlang and C# .
I'm benchmarking using the statistics module. I'm not doing any io:fwrites,
Between the two C# processes it takes about 15 seconds.
Is this typical for port performance? I can't think of any way to further
optimize what I'm doing. I understand that Erlang has to manage the VM,
whereas the C# programs are just constantly reading/writing from
stdin/stdout, but that seems like a huge performance discrepancy.
More information about the erlang-questions