Digital signal processing routines in Node.js?

I'd like to have all the advantages of Node.js for writing web-based applications at my disposal. However, I'm aware that its model isn't great for running computational intensive DSP functions. I was skimming the documentation and found that there was an area on addons.

I guess my question is this: if I wrote my DSP functions in C++ (or brought it in from somewhere else), and incorporated them into my Node.js application, how much of a slowdown would I experience? I'm under the impression that since I'm making calls to a shared library, I shouldn't experience any slowdown. Any insight on this would be great.

You don't have to build a binary addon to interoperate with your C++ code. Perhaps you could turn the C++ code into a command line tool?

You can then use the child_process module in node to spawn a process of your DSP tool and use some kind of IPC (inter-process communication) such as Unix sockets to communicate between node and c++.

This way you eradicate the need for too much C++ glue code.

Child Process: http://nodejs.org/api/child_process.html

Net (for sockets): http://nodejs.org/api/net.html

It would only be as slow as your individual components. Node wouldn't block while waiting for data from your C++, so can be doing other things (responding to HTTP requests etc).

Another option for IPC is to use a message passing library such as zeromq.

zeromq c++ bindings: http://zeromq.org/bindings:cpp

zeromq node binding: http://zeromq.org/bindings:node-js