Created
October 10, 2013 15:54
-
-
Save michaeldwan/6920745 to your computer and use it in GitHub Desktop.
Quick and dirty zlib benchmark
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
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:entry]; | |
NSLog(@"%@", data); | |
NSLog(@"Uncompressed: %d", [data length]); | |
double start; | |
start = [NSDate timeIntervalSinceReferenceDate]; | |
for (int x = 0; x < 50000; x++) { | |
[[data zlibDeflate] length]; | |
} | |
NSLog(@"z took %f seconds", [NSDate timeIntervalSinceReferenceDate] - start); | |
start = [NSDate timeIntervalSinceReferenceDate]; | |
for (int x = 0; x < 50000; x++) { | |
[[data gzipDeflate] length]; | |
} | |
NSLog(@"gz took %f seconds", [NSDate timeIntervalSinceReferenceDate] - start); | |
NSLog(@"zlib Compressed: %d", [[data zlibDeflate] length]); | |
NSLog(@"gzip Compressed: %d", [[data gzipDeflate] length]); | |
id decoded = [NSKeyedUnarchiver unarchiveObjectWithData:data] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment