Thus said Richard Hipp on Tue, 18 Oct 2016 15:48:57 -0400:

> it  is reported  that Hg  has developed  a blame-cache  mechanism that
> makes "blame"  and "annotate"  about 10x faster.  If anybody  wants to
> look into this and see if  something similar could be done for Fossil,
> that would be great!

What would be the approach taken in  Fossil? Would the cache simply be a
cache  of  previous  results?  Or  would it  be  more  dynamic  in  that
committing code would dynamically update  the cache with modified lines?
Also,  would this  be stored  in the  local checkout  DB, or  the cloned
fossil DB?

I ran  the following  against the  SQLite repository  just to  see which
files would most benefit  from such a cache. It looks  like the first 14
could definitely benefit. After that, they are quickly annotated:

$ echo "SELECT name FROM (SELECT count(*) AS c, name FROM mlink JOIN filename 
USING (fnid) GROUP BY fnid ORDER BY c DESC LIMIT 20);" | fossil sql | while 
read x; do printf "%s " "$x"; /usr/bin/time fossil anno "$x" 2>&1 >/dev/null; 
done | awk 'BEGIN { printf("%20s %8s %8s %8s\n", "filename", "real", "user" >
echo "SELECT name FROM (SELECT count(*) AS c, name FROM mlink JOIN filename 
USING (fnid) GROUP BY fnid ORDER BY c DESC LIMIT 20);" | fossil sql | while 
read x; do printf "%s " "$x"; /usr/bin/time fossil anno "$x" 2>&1 >/dev/null; 
done | awk 'BEGIN { printf("%20s %8s %8s %8s\n", "filename", "real", "user", 
"sys"); } { printf("%-20s %8s %8s %8s\n", $1, $2, $4, $6); }'
src/sqliteInt.h          7.14     6.86     0.32
src/vdbe.c              10.91    10.49     0.43
src/where.c              4.89     4.51     0.37
src/btree.c             14.81    13.79     1.05
src/sqlite.h.in         11.68    10.71     0.96
src/main.c               2.43     2.31     0.12
src/vdbeaux.c            3.41     3.34     0.08
src/pager.c              7.76     7.30     0.44
src/select.c             5.30     5.08     0.20
src/build.c              4.10     4.01     0.10
src/expr.c               3.52     3.40     0.12
src/os_unix.c            5.68     5.46     0.21
src/test1.c              4.65     4.50     0.14
src/shell.c              2.56     2.45     0.13
main.mk                  0.35     0.33     0.02
Makefile.in              0.47     0.44     0.04
src/os_win.c             2.15     2.09     0.05
src/pragma.c             0.81     0.81     0.01
src/insert.c             0.94     0.89     0.03
Makefile.msc             0.55     0.53     0.01


Fossil, on the other hand, having  the SQLite amalgamation, churns a bit
on sqlite3.c:

$ echo "SELECT name FROM (SELECT count(*) AS c, name FROM mlink JOIN filename 
USING (fnid) GROUP BY fnid ORDER BY c DESC LIMIT 20);" | fossil sql | while 
read x; do printf "%s " "$x"; /usr/bin/time fossil anno "$x" 2>&1 >/dev/null; 
done | awk 'BEGIN { printf("%20s %8s %8s %8s\n", "filename", "real", "user" >
echo "SELECT name FROM (SELECT count(*) AS c, name FROM mlink JOIN filename 
USING (fnid) GROUP BY fnid ORDER BY c DESC LIMIT 20);" | fossil sql | while 
read x; do printf "%s " "$x"; /usr/bin/time fossil anno "$x" 2>&1 >/dev/null; 
done | awk 'BEGIN { printf("%20s %8s %8s %8s\n", "filename", "real", "user", 
"sys"); } { printf("%-20s %8s %8s %8s\n", $1, $2, $4, $6); }'
            filename     real     user      sys
src/db.c                 1.38     1.33     0.05
src/main.c               1.14     1.12     0.03
src/checkin.c            0.92     0.87     0.05
src/timeline.c           1.09     1.05     0.05
src/info.c               1.15     1.11     0.04
src/makemake.tcl         0.57     0.54     0.03
src/sqlite3.c          654.31   643.94    10.18
src/sqlite3.h            8.12     7.57     0.58
src/diff.c               0.75     0.72     0.02
win/Makefile.mingw       0.54     0.51     0.03
src/style.c              0.29     0.28     0.02
src/setup.c              0.59     0.55     0.03
src/xfer.c               0.51     0.49     0.03
win/Makefile.mingw.mistachkin     0.47     0.43     0.05
win/Makefile.msc         0.27     0.25     0.03
src/manifest.c           0.51     0.47     0.05
src/main.mk              0.34     0.33     0.01
src/tkt.c                0.26     0.25     0.00
www/changes.wiki         0.19     0.17     0.01
src/wiki.c               0.26     0.26     0.00

Thanks,

Andy
-- 
TAI64 timestamp: 400000005812feb3


_______________________________________________
fossil-dev mailing list
fossil-dev@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev

Reply via email to