Kyle Paulsen
Kyle Paulsen

Reputation: 1006

Matrix multiplication in Node.js with multithreading?

I know this is a strange thing to do but I just want to know if it's possible.

Can you get real performance gains in Node.js for processor heavy computations if you used node's cluster module or some other multithreading / multiprocess module? Note: this is a client side only program (No network stuff).

For example, I tried making a matrix multiplication program in node.js using the cluster module where I assigned each process a row of the answer to calculate. However because node.js prevents sharing memory, I have to rely on message passing to send the large calculated rows back to the parent process. This was way slower than just performing the matrix multiplication serially. Maybe I'm just doing something wrong or I have a bad strategy but I'm just curious if anyone else has been able to operate on large pieces of data with node.js and really use the full power of their processor. If so, how would I go about doing this?

Upvotes: 2

Views: 1377

Answers (1)

Nuray Altin
Nuray Altin

Reputation: 1324

JXcore (a node.js distro) is currently your best bet for cpu heavy operations with node.js. It has multithreaded tasks support with a visible performance.

Upvotes: 1

Related Questions