erl_ddll vs. stdio drivers

James Hague jamesh@REDACTED
Thu Jan 2 20:36:04 CET 2003


I've been using erl_ddll to hook to external code--via a Windows DLL--but
lately I've been wondering why I'm doing this instead of using pipes.  The
traditional advantage of the former is "much faster communication" but there
are some big advantages to the latter:

1. Simpler interface (no need to handle the various callbacks from the
runtime system, no need to fill in a structure with callback pointers--some
of which are no longer valid--and pass it back to the runtime).
2. Can't accidentally take down the entire emulator.
3. "Driver" can be a standard executable, which is nice because not all
languages can generate DLLs.  Even if you're not a language addict, it's
nice to be able to whip up a quickie driver in Perl or Python.
4. "Driver" can be used with other languages, not just Erlang, or even
tested without having to be linked to from Erlang.

>From a purist's point of view using pipes is cleaner.  So here's my
question:  How significant is the speed difference  between the two methods
under Windows?  "Twice as fast" makes no difference if we're talking
microseconds, but I suspect that because a pipe involves several task
switches the minimum time for a call and response is going to be 20
milliseconds or so.  Has anyone done any timings?

Happy new year!

James



More information about the erlang-questions mailing list