Created
June 24, 2014 21:23
-
-
Save MichaelAquilina/eed24f24cefe25121797 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
#! /usr/bin/python | |
import gzip | |
import bz2 | |
import time | |
import os | |
target_dir = '/home/michaela/Development' | |
t0 = time.time() | |
with gzip.GzipFile(os.path.join(target_dir, 'reddit.json.gz'), 'r') as f: | |
f.read() | |
print 'Gzip Runtime = {}'.format(time.time() - t0) | |
t0 = time.time() | |
with bz2.BZ2File(os.path.join(target_dir, 'reddit.json.bz2'), 'r') as f: | |
f.read() | |
print 'Bz2 Runtime = {}'.format(time.time() - t0) | |
t0 = time.time() | |
with open(os.path.join(target_dir, 'reddit.json'), 'r') as f: | |
f.read() | |
print 'Open Runtime = {}'.format(time.time() - t0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment