[PATCH] Calculate file sha1 in block [PATCH]

Harri Salokorpi hsalokor at ee.oulu.fi
Sun Apr 17 10:41:51 BST 2005


Hello,

Fredrik Lundh wrote:
> one thing that might work would be to put the commands into separate
> modules (e.g. bzrlib/commands/init.py), and only import the command
> implementations as needed. 

Some savings can be obtained just by trimming and lazifying the 
command.py imports. Some imports seemed unnecessary, so I removed them 
and tested the difference (patch attached). In particular, I moved least 
used imports from header to code (difflib).

I used following script for determining the performance difference 
between my stripped version and bzr.dev, since bzr version times ~0.1 
seconds on my system.

#!/bin/sh
for i in `seq 1 100`;
do
         bzr version &> /dev/null
         bzr &> /dev/null
         bzr help &> /dev/null
done

Results were quite encouraging:

* Non-trimmed version:
test-startup.sh  35.69s user 5.36s system 98% cpu 41.720 total
test-startup.sh  35.66s user 5.24s system 99% cpu 41.290 total
test-startup.sh  35.64s user 5.21s system 98% cpu 41.278 total

* Trimmed version:
test-startup.sh  24.16s user 4.84s system 94% cpu 30.778 total
test-startup.sh  24.16s user 4.96s system 99% cpu 29.332 total
test-startup.sh  24.11s user 5.06s system 94% cpu 30.830 total

I ran tests and bzr diff|status|commit, and nothing seems to be broken 
by my hackjob. Smack me if I removed something important ;)

-Harri
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: trim_imports.diff
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20050417/d42734f6/attachment.diff 


More information about the bazaar mailing list