Node-fib: Fast non-blocking fibonacci server
1–10 of 124 posts
Re: Node-fib: Fast non-blocking fibonacci server
#2Re: Node-fib: Fast non-blocking fibonacci server
#3Re: Node-fib: Fast non-blocking fibonacci server
#4Re: Node-fib: Fast non-blocking fibonacci server
#5Fib(n) = round(φ^n / sqrt(5)), where φ = (1 + sqrt(5)) / 2.
Cites:
http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html...
https://secure.wikimedia.org/wikipedia/en/wiki/Fibonacci_num...
Re: Node-fib: Fast non-blocking fibonacci server
#6Re: Node-fib: Fast non-blocking fibonacci server
#7 fibonacci(40,function(f) {
console.log(f);
});Re: Node-fib: Fast non-blocking fibonacci server
#8In this case concurrent requests take advantage of each others' memoisation, which would be somewhat trickier to do with threads as you'd probably need to worry about locking.
Re: Node-fib: Fast non-blocking fibonacci server
#9Re: Node-fib: Fast non-blocking fibonacci server
#10Actually, if the async lib memoization facility shares values between requests, which seems quite sure to me, all requests but the first one are served from its cache in the test the author uses as example. This still doesn't highlight any strength of node.js IMO, asides from the easy shared memoization. It could be translated to Tornado-web, an async Python framework, almost literally.