|
|
|
|
|
by josephg
5368 days ago
|
|
There are nodejs web worker implementations to help with that kind of problem: https://github.com/pgriess/node-webworker If you use webworkers for cpu-intensive tasks (like fib), nodejs will perform just as well as all the other web frameworks out there. |
|
And if you do consider workers (because you don't have a better algorithm), what happens for the cheap version? Do you offload it to a worker as well, potentially incurring a spin-off cost greater than the cost of the computation itself, or do you end up with two different codepaths (one sync and one async, just to ensure you're getting as complex as you can) depending on the computation's expected duration?