[MERGE] Improve decorators when necessary
John Arbash Meinel
john at arbash-meinel.com
Wed Jan 24 20:46:34 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The attached patch includes the new form of decorators into bzrlib. And
then it disables them from the 'bzr' command script. This means that
running 'bzr' will still be fast, but if you use an interactive
interpreter, or it is imported from elsewhere (like by epydoc) you will
get the nice looking documentation.
In testing the difference is 300ms for bzr --version with the new
decorators versus 270ms without them. So the fact that they add 30ms to
startup time is significant, and worth the effort of avoiding it.
(I chose bzr --version since it opens a Branch object which means a lot
of code needs to be imported, but it doesn't do other work like status
would need to do.)
I also add the trick of not importing 'inspect' until needed, since that
is also something that adds considerable overhead (probably most of the
30ms).
And if --lsprof is supplied, I switch back to the "pretty" decorators,
since this makes it much easier to profile what is going on. (And the
decorators shouldn't actually add any runtime overhead, just startup
overhead).
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFt8WqJdeBCYSNAAMRAofLAKC9FijMO1vfYyU+td9P/sJS9g/3xQCdFhBY
rbmdrAVm2L5EO7ELI+9tJxM=
=FjGo
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: decorators.patch
Type: text/x-patch
Size: 37622 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070124/a65993e0/attachment-0001.bin
More information about the bazaar
mailing list