Created
August 27, 2014 17:24
-
-
Save methane/96902026c26bc9cbf57d to your computer and use it in GitHub Desktop.
Benchmark of tornado.speedup.utf8
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
#micro benchmark | |
#CPython 3.4.1 | |
import timeit | |
print(timeit.timeit("utf8('xyzzy')", "from tornado.escape import utf8")) | |
# $ TORNADO_EXTENSION=1 python u8bench.py | |
# 0.0813535709748976 | |
# $ TORNADO_NO_EXTENSION=1 python u8bench.py | |
# 0.8695125280064531 |
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
import time | |
import tornado.ioloop | |
import tornado.web | |
import tornado.httpclient | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hello, world") | |
application = tornado.web.Application([ (r"/", MainHandler), ]) | |
application.listen(8888) | |
tornado.ioloop.IOLoop.instance().start() | |
""" | |
$ TORNADO_EXTENSION=1 python u8bench2.py | |
$ wrk -c1 -t1 -d10 http://127.0.0.1:8888/ | |
Running 10s test @ http://127.0.0.1:8888/ | |
1 threads and 1 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 463.95us 58.54us 1.35ms 93.96% | |
Req/Sec 2.21k 194.95 2.44k 67.23% | |
20832 requests in 10.00s, 4.17MB read | |
Requests/sec: 2084.02 | |
Transfer/sec: 427.39KB | |
$ TORNADO_NO_EXTENSION=1 python u8bench2.py | |
$ wrk -c1 -t1 -d10 http://127.0.0.1:8888/ | |
Running 10s test @ http://127.0.0.1:8888/ | |
1 threads and 1 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 490.17us 56.33us 1.37ms 95.31% | |
Req/Sec 2.08k 149.38 2.22k 82.09% | |
19672 requests in 10.00s, 3.94MB read | |
Requests/sec: 1967.20 | |
Transfer/sec: 403.43KB | |
$ TORNADO_EXTENSION=1 python u8bench2.py | |
$ wrk -c1 -t1 -d10 http://127.0.0.1:8888/ | |
Running 10s test @ http://127.0.0.1:8888/ | |
1 threads and 1 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 483.42us 75.88us 1.43ms 93.36% | |
Req/Sec 2.11k 208.78 2.33k 57.64% | |
20009 requests in 10.00s, 4.01MB read | |
Requests/sec: 2000.90 | |
Transfer/sec: 410.34KB | |
$ TORNADO_NO_EXTENSION=1 python u8bench2.py | |
$ wrk -c1 -t1 -d10 http://127.0.0.1:8888/ | |
Running 10s test @ http://127.0.0.1:8888/ | |
1 threads and 1 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 487.80us 45.18us 0.88ms 93.23% | |
Req/Sec 2.09k 156.29 2.44k 82.63% | |
19823 requests in 10.00s, 3.97MB read | |
Requests/sec: 1982.29 | |
Transfer/sec: 406.53KB | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment