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
#!/usr/bin/env python | |
import inspect | |
import copy | |
### | |
### Options Classes | |
### | |
class DocOptions(object): |
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
ubuntu@ip-10-17-167-43:~$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 2.014980793 seconds... | |
ubuntu@ip-10-17-167-43:~$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 6.96465492249 seconds... | |
ubuntu@ip-10-17-167-43:~$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 5.79786896706 seconds... | |
ubuntu@ip-10-17-167-43:~$ ./downloading_complete.py |
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
With Gevent: | |
Took 4.23808407784 seconds... | |
ubuntu@ip-10-244-197-204:~$ ./downloading_complete.py | |
With Gevent: | |
Took 9.72512888908 seconds... | |
ubuntu@ip-10-244-197-204:~$ ./downloading_complete.py | |
With Gevent: | |
Took 4.29909491539 seconds... | |
ubuntu@ip-10-244-197-204:~$ ./downloading_complete.py | |
With Gevent: |
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
With Multiprocessing: | |
Took 37.3345718384 seconds... | |
ubuntu@domU-12-31-39-09-29-F2:~$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 36.8940429688 seconds... | |
ubuntu@domU-12-31-39-09-29-F2:~$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 37.2605760098 seconds... | |
ubuntu@domU-12-31-39-09-29-F2:~$ ./downloading_complete.py | |
With Multiprocessing: |
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
jd@bean : 03:24:17 : ~/Projects/playpen/gevent | |
$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 32.3140609264 seconds... | |
jd@bean : 03:26:32 : ~/Projects/playpen/gevent | |
$ ./downloading_complete.py | |
With Gevent: | |
Took 32.6940128803 seconds... |
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
jd@bean : 03:11:32 : ~/Projects/playpen/gevent | |
$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 5.50151801109 seconds... | |
(ks27) | |
jd@bean : 03:11:50 : ~/Projects/playpen/gevent | |
$ ./downloading_complete.py | |
With Multiprocessing: | |
Took 11.5246450901 seconds... | |
(ks27) |
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
#! -*- Coding: utf-8 -*- | |
""" | |
Before running the create a virtualenv (I used version 1.7, so no-site-packages is default), activate virtualenv and install gevent, envoy and try running | |
""" | |
from gevent import monkey | |
monkey.patch_all() | |
import gevent | |
import time |
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
#!/usr/bin/env python | |
# Decorator Function | |
def log(f): | |
def _inner(*a, **kw): | |
print 'Calling your function' | |
return f(*a, **kw) | |
return _inner |
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
$ python ./cereal.py | |
Dumping: | |
json: 16.3266839981 | |
simplejson: 21.8916499615 | |
cjson: 5.22964906693 | |
ujson: 2.02208805084 | |
cPickle: 18.5925779343 | |
tnetstrings: 60.592509985 | |
tnetstring: 2.44516205788 | |
msgpack: 21.7611129284 |
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
# gevent | |
from gevent import monkey | |
monkey.patch_all() | |
from gevent.wsgi import WSGIServer | |
http_server = WSGIServer(('', port), app) | |
http_server.serve_forever() | |
# tornado | |
from tornado.wsgi import WSGIContainer | |
from tornado.httpserver import HTTPServer |