Speedup with history-db

John Arbash Meinel john at arbash-meinel.com
Fri May 27 14:49:35 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/27/2011 04:08 PM, Eli Zaretskii wrote:
>> Date: Fri, 27 May 2011 12:23:45 +0300
>> From: Eli Zaretskii <eliz at gnu.org>
>> Cc: bazaar at lists.canonical.com
>>
>> A few comments:
> 
> Here's one more:  I just did a "bzr up", which announced that the tree
> is up to date.  And yet history-db did do something, as this portion
> of the log shows:
> 
>   8.656  fetch up to rev {rgm at gnu.org-20110527071815-pnm36i0e38mb8wte}
>   13.578  history_db post-change-hook took 1.638s (0.012s to get_config, 1.526s to init, 0.100s to import)
>   13.578  Stats:
>   {'num_search_tips': 0,
>    'step mainline': 1,
>    'step mainline added': 4,
>    'step mainline cache missed': 1,
>    'step mainline initial': 1}
>   [ 4216] 2011-05-27 17:06:14.640 INFO: Tree is up to date at revision 104384 of branch bzr+ssh://eliz@bzr.savannah.gnu.org/emacs/trunk
> 
> What is it trying to do for 1.6s?

If you have a branch that has not been imported before, bzr-history-db
is importing it into the db now. Note that it did find 4 revisions that
were not present in the ancestry.

However the time consuming part was:
   13.578  history_db post-change-hook took 1.638s (0.012s to
get_config, 1.526s to init, 0.100s to import)
            ^^^^^^

That is the time it took to do this:
>     importer = _mod_history_db.Importer(history_db_path, params.branch,
>                                         tip_revision_id=params.new_revid,
>                                         incremental=True)

Looking at the code, it is probably the time spent either opening the
database, or possibly the "does the schema exist" code. Looking closely,
that code is a bit bogus:

> def is_initialized(conn, err_type):
>     # Both pgsql and sqlite have ways to tell if a table exists, but they
>     # aren't the *same*, so just punt and ask for content of a table.
>     cursor = conn.cursor()
>     try:
>         cursor.execute('SELECT count(*) FROM revision').fetchall()
>     except err_type: # ???
>         return False
>     return True

Counting the whole revision table is stupid. I just committed what
should be a fix for that (revno 135).

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3fuf8ACgkQJdeBCYSNAAOc3QCdETf4T2C2PRcTHGgJ/pLHy5C0
yMkAnjymb8YbLcQjt1yhoecCqy77WRI6
=V594
-----END PGP SIGNATURE-----



More information about the bazaar mailing list