Messages in this thread | | | From | microcai <> | Date | Mon, 29 Nov 2010 10:21:47 +0800 | Subject | Re: [PATCH] Repalce strncmp by memcmp |
| |
2010/11/29 Pavel Vasilyev <pavel@pavlinux.ru>: > > This patch replace all strncmp(a, b, c) by memcmp(a, b, c). > > I test on x86_64 (AMD Opteron 285). > > #include <string.h> > char *A = "0000"; > void test_memcmp(void) { > memcmp(A, "TEST", 4); > } > void test_strn(void) { > strncmp(A, "TEST", 4); > } > # gcc -c -O2 test.c > # objdump -d test.o > ... > > 0000000000000020 <test_strncmp>: > 20: f3 c3 repz retq > 22: 66 66 66 66 66 2e 0f data32 data32 data32 data32 nopw > %cs:0x0(%rax,%rax,1) > 29: 1f 84 00 00 00 00 00 > > 0000000000000030 <test_memcmp>: > 30: f3 c3 repz retq > > Wow, minus one commad :) >
Wow, good, I test that patch ... can't see any performance improvements. but... works fine. and mem* generally better than str* one, right? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |