Last active
August 29, 2015 14:16
-
-
Save kaiwren/9a2d3bd2072db7e4f2c3 to your computer and use it in GitHub Desktop.
Opal Microbenchmarks from github.com/kaiwren/redson
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
JS.Benchmarks.fact = function(n){ | |
if(n > 1) { | |
return n * this.fact(n-1); | |
} | |
else { | |
return 1; | |
} | |
} |
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
module Benchmarks | |
def self.fact(n) | |
if (n > 1) | |
n * fact(n-1) | |
else | |
1 | |
end | |
end | |
end |
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
JS.Benchmarks.fib = function(n){ | |
return n < 2 ? n : this.fib(n - 1) + this.fib(n - 2); | |
} |
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
module Benchmarks | |
def self.fib(n) | |
n < 2 ? n : fib(n - 1) + fib(n - 2) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment