memcmp-intensive code becomes up to 6 times slower if compiled with the -O3
option than with the -g or -O0 option. The reason for this is that the inline
memcmp function is *much* slower than the glibc memcmp.
Here's a simple test case:
#include
#include
#include
#include
void* list[1024 * 1024];
int main(void)
{
int count = sizeof(list) / sizeof(char*);
int i;
for (i=0; i < count; i++)
list[i] = calloc(1024, 1);
int dupes = 0;
int start = times(NULL);
for (i=0; ihttp://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052