Using psyco acceleration

John Dong jdong at ubuntu.com
Sun Mar 5 18:33:03 GMT 2006


Why does bzr not use Psyco?

On a 2GB repository, using psyco.background() reduced the "bzr st" operation
from 5 seconds to 4 seconds, an appreciated speedup.

Below is the quick patch I made; if psyco is installed, it'll use it in the
unobtrusive background profiling mode. If it's not installed, the
ImportError is caught and we move on. The break-even point is the time it
takes to perform the import of psyco (not any longer than importing a
plugin).

=== modified file 'a/bzr'
--- a/bzr
+++ b/bzr
@@ -17,6 +17,11 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 """Bazaar-NG -- a free distributed version-control tool"""
 import os, sys
+try:
+    import psyco
+    psyco.background()
+except ImportError: pass
+
 if __doc__ is None:
     print "bzr does not support python -OO."
     sys.exit(2)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20060305/70e4256a/attachment.htm 


More information about the bazaar mailing list