8 ms·
Wow, didn't expect this to make the front page of HN. There's more context in the groups thread (http://groups.google.com/group/python-tornado/browse_thread/th
by bdarnell 16y ago
Wow, didn't expect this to make the front page of HN. There's more context in the groups thread (http://groups.google.com/group/python-tornado/browse_thread/thread/94b45e815ac992ac http://groups.google.com/group/python-tornado/browse_thread/...), but the short version is that a change to abstract away some error handling with the python 'with' statement had a surprising performance impact. When used with the @contextlib.contextmanager decorator, the with statement is more than 25 times as expensive as a try/except statement.
- tomwans 16y agoyeah, I didn't know HN still cared about Tornado. I thought I was the only one using it for production ...
- BarkMore 16y agoYou and FriendFeed, Hipmunk, Brizzly, Bitly (they recently built async mongodb driver for use with Tornado), Quora (for long polling), ...
- petdog 16y agoIt looks like you forgot to call the function in 'simple_catch'. Interestingly, if you do, manual_with_catch will actually be faster in the failing case. (A try:fn() finally: return True beats everything else in the failing case)
- bdarnell 16y agoAh, that makes a big difference. Thanks for the correction.