Database read optimizations
commitb221af660d101301606e263cef73b358937516a6
authorDan McGee <dan@archlinux.org>
Mon, 29 Aug 2011 03:20:41 +0000 (28 22:20 -0500)
committerDan McGee <dan@archlinux.org>
Mon, 29 Aug 2011 04:49:27 +0000 (28 23:49 -0500)
treee49e89dbd2314e9b2f972c29d14dc0c63a61121a
parent040083b97fab61c8afc16a1c49a8384d097c272a
Database read optimizations

Hard to believe there was still more room to improve on this, but I
found an easily correctable oversight tonight. Our databases (both sync
and local) contain many blank lines, and we were not moving onto the
next line right away in these cases; instead we would proceed through
our strcmp() conditional checks as normal.

Some local numbers follow to show the effects of this patch:

Sync `-Ss foobarbaz`:
71,709 blank lines skipped early
~1,505,889 strcmp() calls avoided (21 per line)
~15% speed improvement (.210 --> .179 sec)

Local `-Qs foobarbaz`:
6,823 blank lines skipped early
115,991 strcmp() calls avoided (17 per line)
~6% speed improvement (.080 -> .071 sec)

Signed-off-by: Dan McGee <dan@archlinux.org>
lib/libalpm/be_local.c
lib/libalpm/be_sync.c