Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Edge.js is 32x faster than a cross-process call
Edge.js allows node.js applications to call CLR code in-process. For heterogeneous applications that have components written in node.js and .NET, edge.js provides an alternative to using cross-process communication mechanisms to exchange data between node.js process and CLR process.
The measurements below compare the latency of a call from node.js to C# made in-process using edge.js and latency of a functionally equivalent cross-process, localhost call over HTTP from a node.js process to a CLR process. In both cases the caller invokes .NET function that returns an instance of a book. The book contains information about the author (first and last name), price (double), availability (boolean), description (long string), and a picture (16KB byte array). To give you an idea of the size of a book, if serialized to JSON it would be about 22KB. You can see the test code here.
For each variation, the latency measurement is making 10,000 sequential calls and computing the average duration of one call given the elapsed time. Results are shown below.
The measurements were not taken at 100% CPU utilization. With fully saturated CPU they would likely be different (expected even more in favor of edge.js compared to cross-process call). The measurements were taken using node.js 0.8.19 x64 and edge.js 0.7.9 on ThinkPad T430 running Windows 8.