Created
March 9, 2015 04:10
-
-
Save kaiwren/3897a4890978fdbf3905 to your computer and use it in GitHub Desktop.
Opal Microbenchmarks with inline js 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
module Benchmarks | |
def self.fact_inline_js(n) | |
%x{ | |
if(n > 1) { | |
return n * this.$fact_inline_js(n-1); | |
} | |
else { | |
return 1; | |
} | |
} | |
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
module Benchmarks | |
def self.fib_inline_js(n) | |
`return n < 2 ? n : this.$fib_inline_js(n - 1) + this.$fib_inline_js(n - 2);` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment