Mercurial > public > mercurial-scm > hg-stable
changeset 52657:d7368933f4b0
git: switch changelog.shortest from LIKE to GLOB to speed up matching
For whatever reason, LIKE is way slower than GLOB. The slowdown is a
function of the number of commits in the repository.
The following data has been collected on a repository with approximately
1.2M commits. The numbers are in milliseconds and they represent the
latency of the changelog.shortest function as measured by time.time().
The shortest function was invoked via `hg log -l50 -T '{node|shortest}\n'`.
Min. 1st Qu. Median Mean 3rd Qu. Max.
279.0 284.3 419.8 381.7 421.3 426.2 (LIKE)
0.08535 0.10437 0.12231 0.11919 0.12779 0.21291 (GLOB)
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 04 Jan 2025 09:38:51 -0500 |
parents | 482728ca94c1 |
children | 86920d1f7632 |
files | hgext/git/gitlog.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/git/gitlog.py Wed Jan 08 22:52:01 2025 -0500 +++ b/hgext/git/gitlog.py Sat Jan 04 09:38:51 2025 -0500 @@ -303,8 +303,8 @@ candidate = nodehex[:attempt] matches = int( self._db.execute( - 'SELECT COUNT(*) FROM changelog WHERE node LIKE ?', - (pycompat.sysstr(candidate + b'%'),), + 'SELECT COUNT(*) FROM changelog WHERE node GLOB ?', + (pycompat.sysstr(candidate + b'*'),), ).fetchone()[0] ) if matches == 1: