Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is JavaScript that bad for implementing heavy computation tasks?

How bad is it, to use JavaScript (CoffeeScript) for implementing a heavy computational task? I am concerned with an optimization problem, where an optimal solution cannot be computed that fast.

JavaScript was chosen in the first place, because visualization is required and instead of adding the overhead for communication between different processes the decision was to just implement everything in JavaScript.

I don't see a problem with that, especially when looking at the benchmarks game. But I often receive the question: Why on earth JavaScript?

I would argue in the following way: It is an optimization problem, NP-hard. It does not matter how much faster another language would be, since this only adds a constant factor to the running time - is that true?

like image 517
Konrad Reiche Avatar asked Nov 30 '11 00:11

Konrad Reiche


1 Answers

Brendan Eich (Mozilla's CTO and creator of JavaScript) seems to think so.

http://brendaneich.com/2011/09/capitoljs-rivertrail/

I took time away from the Mozilla all-hands last week to help out on-stage at the Intel Developer Forum with the introduction of RiverTrail, Intel’s technology demonstrator for Parallel JS — JavaScript utilizing multicore (CPU) and ultimately graphics (GPU) parallel processing power, without shared memory threads (which suck).

See especially his demo of JS creating a scene graph:

Here is my screencast of the demo. Alas, since RiverTrail currently targets the CPU and its short vector unit (SSE4), and my screencast software uses the same parallel hardware, the frame rate is not what it should be. But not to worry, we’re working on GPU targeting too.

At CapitolJS and without ScreenFlow running, I saw frame rates above 35 for the Parallel demo, compared to 3 or 2 for Sequential.

like image 137
Mike Samuel Avatar answered Oct 24 '22 07:10

Mike Samuel