Dont bother with digest and link comparisons if size differs, part II
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 19 Oct 2012 10:54:11 +0000 (13:54 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 19 Oct 2012 11:36:36 +0000 (14:36 +0300)
- If link or regular file sizes differ, they cannot possibly be
  identical. Saves us from doing bunch of pointless string and
  memory comparisons on what's a very busy path - not exactly a huge
  with but measurable nevertheless.

lib/rpmfi.c

index e83ce2f..42fbdcd 100644 (file)
@@ -504,6 +504,11 @@ int rpmfiCompareIndex(rpmfi afi, int aix, rpmfi bfi, int bix)
 
     if (amode != bmode) return 1;
 
+    if (awhat == LINK || awhat == REG) {
+       if (rpmfiFSizeIndex(afi, aix) != rpmfiFSizeIndex(bfi, bix))
+           return 1;
+    }
+
     if (!rstreq(rpmfiFUserIndex(afi, aix), rpmfiFUserIndex(bfi, bix)))
        return 1;
     if (!rstreq(rpmfiFGroupIndex(afi, aix), rpmfiFGroupIndex(bfi, bix)))