Skip to content

Instantly share code, notes, and snippets.

@Watson1978
Created September 15, 2012 14:02
Show Gist options
  • Select an option

  • Save Watson1978/3728085 to your computer and use it in GitHub Desktop.

Select an option

Save Watson1978/3728085 to your computer and use it in GitHub Desktop.
require 'mobiruby'
#require 'hello'
#require 'samegame_app'
def fib(n)
return 0 if n <= 0
return 1 if n == 1
return fib(n - 2) + fib(n - 1)
end
s = Cocoa::NSDate._date
fib(37)
e = Cocoa::NSDate._date
puts "time = " + e._timeIntervalSinceDate(s).to_f.to_s
#RubyMotion
def fib(n)
return 0 if n <= 0
return 1 if n == 1
return fib(n - 2) + fib(n - 1)
end
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
s = NSDate.date
fib(37)
e = NSDate.date
puts "time = " + e.timeIntervalSinceDate(s).to_f.to_s
true
end
end
@Watson1978

Copy link
Copy Markdown
Author

MobiRuby

time = 20.022701025009

RubyMotion

time = 0.926409959793091

@Watson1978

Copy link
Copy Markdown
Author

I've measured on simulator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment