Created
September 15, 2012 14:02
-
-
Save Watson1978/3728085 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
| 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 |
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
| #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 |
Author
Author
I've measured on simulator
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MobiRuby
time = 20.022701025009
RubyMotion
time = 0.926409959793091