1

I am currently in the process of building a Finance library for Javascript(Browser and Node)

One of the main features of the library is doing simulations with options, therefore there is a lot of computation that goes into generating the simulations.

I am currently using a library I wrote called AsyncManager which uses HTML5 webworkers(node-webworker) and distributes calculations across a certain number of webworkers. The way I am doing this is by serializing the javascript calculation objects(Calc objects have to implement one method called calculate(args)) including the functions.

(I do the function serialization by changing the functions into the string form of themselves and then I eval them in the webworker to turn them back into functions.)

I was wondering if anyone had thought of a better way to distribute load in javascript using webworkers without knowing the computation ahead of time.

Zaheer Ahmed
  • 28,160
  • 11
  • 74
  • 110
Jeff
  • 873
  • 2
  • 10
  • 16
  • I would suggest switching to server side computation. Any reason for sticking to client side? – Mrchief Oct 23 '11 at 07:28
  • I would start by trying to solve this problem server-side, but I'm curious to see what will come of trying to solve this with HTML5 and browsers. – ObscureRobot Oct 23 '11 at 07:48
  • Well I am building this library so that it can be run server-side or client side which is why I am using the standard webworker interface to distribute calculations. I am just going to assume that for right now this is the best way and continue on. Thanks. – Jeff Oct 23 '11 at 16:06
  • Could you elaborate a little more, or give a code example of what you are currently doing? – TrippLamb Sep 17 '13 at 20:08

0 Answers0