Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Testing 7.0 Beta: FFS still very slow when creating files



   Date: Mon, 25 Aug 2014 15:55:53 +0200
   From: "J. Hannken-Illjes" <hannken%eis.cs.tu-bs.de@localhost>

   GCC 4.5.4 disabled builtin memcmp as x86 has no cmpmemsi pattern.

   See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052, Comment 16.

   Could this be the cause of this big loss in performance?

Shouldn't be too hard to test this.  Perhaps try dropping in the
following replacements for the vcache key comparison and running the
test for each one?
static inline int
memequal_memcmp(const void *va, const void *vb, size_t n)
{

        return memcmp(va, vb, n) != 0;
}

static inline int
memequal_repz_cmpsb(const void *va, const void *vb, size_t n)
{
        register uint8_t r;

        __asm__ __volatile__ ("                                 \n\
                cmp     %1,%1                                   \n\
                repz    cmpsb %%es:(%%rdi),%%ds:(%%rsi)         \n\
                sete    %0                                      \n\
        " : "=a"(r) : "r"(n), "D"(va), "S"(vb), "c"(n));

        return r;
}

/* For completeness, let's try this portable version without REP.  */
static inline int
memequal_naive(const void *va, const void *vb, size_t n)
{
        const unsigned char *ca = va;
        const unsigned char *cb = vb;

        while (n--)
                if (*ca++ != *cb++)
                        return 0;

        return 1;
}


Home | Main Index | Thread Index | Old Index