Created
October 2, 2011 18:15
-
-
Save cykod/1257721 to your computer and use it in GitHub Desktop.
Fib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ab -n 4000 -c 100 http://localhost:1337/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 400 requests | |
Completed 800 requests | |
Completed 1200 requests | |
Completed 1600 requests | |
Completed 2000 requests | |
Completed 2400 requests | |
Completed 2800 requests | |
Completed 3200 requests | |
Completed 3600 requests | |
Completed 4000 requests | |
Finished 4000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 1337 | |
Document Path: / | |
Document Length: 9 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 0.775 seconds | |
Complete requests: 4000 | |
Failed requests: 0 | |
Write errors: 0 | |
Total transferred: 292000 bytes | |
HTML transferred: 36000 bytes | |
Requests per second: 5159.56 [#/sec] (mean) | |
Time per request: 19.381 [ms] (mean) | |
Time per request: 0.194 [ms] (mean, across all concurrent requests) | |
Transfer rate: 367.82 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.5 0 4 | |
Processing: 3 19 8.9 19 45 | |
Waiting: 3 19 8.9 19 45 | |
Total: 3 19 8.9 19 45 | |
Percentage of the requests served within a certain time (ms) | |
50% 19 | |
66% 24 | |
75% 26 | |
80% 28 | |
90% 31 | |
95% 33 | |
98% 36 | |
99% 37 | |
100% 45 (longest request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var fib = {}; | |
function fibonacci(n) { | |
if(fib[n]) return fib[n]; | |
if (n < 2) | |
return 1; | |
else | |
return fib[n] = fibonacci(n-2) + fibonacci(n-1); | |
} | |
fibonacci(40); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end("" + fibonacci(40)); | |
}).listen(1337, "127.0.0.1"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment