Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const benchmark = require('nodemark');
- function fib(n) {
- if(n > 1){
- return fib(n-1) + fib(n-2)
- } else {
- return n;
- }
- }
- function test() {
- var results = []
- for(var i = 0; i < 40; i++){
- results.push(fib(i));
- }
- }
- const result = benchmark(test);
- console.log(result.milliseconds())
- console.log(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement