ANN: withrestart 0.2.1
Ryan Kelly
ryan at rfk.id.au
Fri Dec 18 20:21:57 EST 2009
On Fri, 2009-12-18 at 07:12 -0500, Neal Becker wrote:
> I haven't tried it, but it sounds really cool. I suppose I should expect a
> lot more overhead compared to try/except, since it's not built-in to python?
It's a pretty thin layer on top of try/except so I'll be surprised if
there is *too* much overhead. The only overhead is at establishment
and/or invocation time - calling some extra functions, walking a few
stack frames, etc.
I've attached a highly scientific benchmark I threw together this
morning. Results:
Establishing a restart/tryexcept but not using it:
test_tryexcept0: 1.23 usec
test_restarts0: 34.90 usec
Establishing a restart/tryexcept, returning a new value:
test_tryexcept1: 3.56 usec
test_restarts1: 67.30 usec
Establishing a restart/tryexcept, raising a new error:
test_tryexcept2: 5.86 usec
test_restarts2: 90.20 usec
Not having to pass status flags or callback functions through every
layer of your API to properly recover from errors:
tryexcept: impossible :-(
withrestart: priceless :-)
Cheers,
Ryan
--
Ryan Kelly
http://www.rfk.id.au | This message is digitally signed. Please visit
ryan at rfk.id.au | http://www.rfk.id.au/ramblings/gpg/ for details
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timetest.py
Type: text/x-python
Size: 1833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20091219/47c03383/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20091219/47c03383/attachment-0001.sig>
More information about the Python-list
mailing list