Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Created April 9, 2014 18:46
Show Gist options
  • Save nolanlawson/10302047 to your computer and use it in GitHub Desktop.
Save nolanlawson/10302047 to your computer and use it in GitHub Desktop.
print_pouchdb_size.py
#!/usr/bin/env python
#
# Prints the pouchdb.min.js and gzipped file sizes for
# all PouchDB builds in the past several months.
#
import requests, zlib
def main():
print 'Commit','GitHub link','Date','pouchdb.min.js size','gzipped size'
url = 'http://pouchtest.com/couchdb/pouchdb_builds/'
response = requests.get(url + '_design/by_timestamp/_view/by_timestamp', params={'include_docs' : True}).json()
for row in response['rows']:
js = requests.get(url + row['id'] + '/pouchdb.min.js').text.decode('utf8')
gzipped_js = zlib.compress(js)
print row['id'], 'https://github.com/pouchdb/pouchdb/commit/' + row['id'], row['doc']['date'], len(js), len(gzipped_js)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment