Skip to content

Instantly share code, notes, and snippets.

@MichaelAquilina
Created June 24, 2014 21:23
Show Gist options
  • Save MichaelAquilina/eed24f24cefe25121797 to your computer and use it in GitHub Desktop.
Save MichaelAquilina/eed24f24cefe25121797 to your computer and use it in GitHub Desktop.
#! /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