Created
November 6, 2015 02:12
-
-
Save Catfish-Man/1deca0ece0b1c3fd26c0 to your computer and use it in GitHub Desktop.
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
import Foundation | |
class Test | |
{ | |
func testing2(var x : Int) -> Int | |
{ | |
if x % 3 == 0 { | |
x += 10 | |
} | |
x++ | |
return x | |
} | |
func test() | |
{ | |
var time = NSDate.timeIntervalSinceReferenceDate(); | |
var x = 0; | |
for (var i = 0; i < 100000000; i++) | |
{ | |
x = testing2(x) | |
} | |
let time2 = NSDate.timeIntervalSinceReferenceDate() - time | |
NSLog("%f seconds", time2) | |
} | |
} | |
Test().test() | |
vs | |
#import <Foundation/Foundation.h> | |
@interface Test : NSObject { | |
} | |
@end | |
@implementation Test | |
- (int)testing2:(int)x | |
{ | |
if (x % 3 == 0) x += 10; | |
x++; | |
return x; | |
} | |
- (void)stuff | |
{ | |
NSTimeInterval time = [NSDate timeIntervalSinceReferenceDate]; | |
int x = 0; | |
for (int i = 0; i < 100000000; i++) | |
{ | |
x = [self testing2:time]; | |
} | |
time = [NSDate timeIntervalSinceReferenceDate] - time; | |
NSLog(@"%f seconds!", time); | |
} | |
@end | |
int main() { | |
Test *t = [[Test alloc] init]; | |
[t stuff]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment