Created
January 10, 2016 21:23
-
-
Save proprietary/046d169c7390d7867df0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* Demo of fibs in an imperative style | |
* Made for benchmarking against a functional | |
* style equivalent code | |
*/ | |
function fib(max) { | |
var ret = [0]; | |
var last = 0; | |
var next = 1; | |
var temp; | |
do { | |
ret.push(next); | |
temp = next; | |
next += last; | |
last = temp; | |
} while(next < max); | |
return ret; | |
} | |
(function() { | |
let r = fib(1000); | |
console.log(r); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment