Skip to content

Instantly share code, notes, and snippets.

@kaiwren
Created March 9, 2015 04:10
Show Gist options
  • Save kaiwren/3897a4890978fdbf3905 to your computer and use it in GitHub Desktop.
Save kaiwren/3897a4890978fdbf3905 to your computer and use it in GitHub Desktop.
Opal Microbenchmarks with inline js from github.com/kaiwren/redson
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
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