Created
March 9, 2012 13:51
Revisions
-
Big Nerd Ranch, Inc. revised this gist
Mar 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ int main (void) { [thing1 isEqual: thing2]; } }); printf ("isEqual: time: %f\n", time); time = BNRTimeBlock(^{ for (int i = 0; i < LOOPAGE; i++) { -
Big Nerd Ranch, Inc. revised this gist
Mar 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ int main (void) { time = BNRTimeBlock(^{ for (int i = 0; i < LOOPAGE; i++) { [thing1 isEqual: thing2]; } }); printf ("isEqualTo: time: %f\n", time); -
Big Nerd Ranch, Inc. revised this gist
Mar 9, 2012 . 1 changed file with 26 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #define LOOPAGE 10000000 #import "BNRTimeBlock.h" int main (void) { CGFloat time; NSString *thing1 = @"hi"; NSString *thing2 = @"hello there"; time = BNRTimeBlock(^{ for (int i = 0; i < LOOPAGE; i++) { [thing1 isEqualTo: thing2]; } }); printf ("isEqualTo: time: %f\n", time); time = BNRTimeBlock(^{ for (int i = 0; i < LOOPAGE; i++) { [thing1 isEqualToString: thing2]; } }); printf ("isEqualToString: time: %f\n", time); return 0; } // main -
Big Nerd Ranch, Inc. revised this gist
Mar 9, 2012 . 2 changed files with 1 addition and 24 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ CGFloat BNRTimeBlock (void (^block)(void)); 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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +0,0 @@ -
Big Nerd Ranch, Inc. created this gist
Mar 9, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #import <mach/mach_time.h> // for mach_absolute_time() and friends CGFloat BNRTimeBlock (void (^block)(void)) { mach_timebase_info_data_t info; if (mach_timebase_info(&info) != KERN_SUCCESS) return -1.0; uint64_t start = mach_absolute_time (); block (); uint64_t end = mach_absolute_time (); uint64_t elapsed = end - start; uint64_t nanos = elapsed * info.numer / info.denom; return (CGFloat)nanos / NSEC_PER_SEC; } // BNRTimeBlock 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #define LOOPAGE 10000000 int main (void) { CGFloat time; NSString *thing1 = @"hi"; NSString *thing2 = @"hello there"; time = BNRTimeBlock(^{ for (int i = 0; i < LOOPAGE; i++) { [thing1 isEqualTo: thing2]; } }); printf ("isEqualTo: time: %f\n", time); time = BNRTimeBlock(^{ for (int i = 0; i < LOOPAGE; i++) { [thing1 isEqualToString: thing2]; } }); printf ("isEqualToString: time: %f\n", time); return 0; } // main