This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Performance problems between gcc 12.2 and 13
- From: Judd Montgomery <judd at engineer dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 17 Jul 2012 16:22:38 -0400
- Subject: Performance problems between gcc 12.2 and 13
After upgrading a server I have noticed that a few applications run
quite a bit slower.
At least one cause and maybe the only cause looks to be in the eglibc
libraries. I compiled eglibc, found some performance differences and
then compiled glibc versions to see if they had the same performance
differences and they do. The slowness appeared between versions 2.12.2
and 2.13 and continues in 2.16.
Here is one example, I can come up with other functions with performance
degredations as well. Does anyone know why and how to fix it?
I compiled glibc with the following:
$ env CFLAGS='-O2 -U_FORTIFY_SOURCE -fno-stack-protector'
../../src/$VERSION/configure --enable-omitfp --prefix=/opt/$VERSION
--enable-add-ons && make && sudo make install
I compiled a test program with:
$ export VERSION=glibc-2.13; gcc -Wall -Xlinker -rpath=/opt/$VERSION/lib
-Xlinker -I/opt/$VERSION/lib/ld-linux-x86-64.so.2 loop.c -o loop.13
$ export VERSION=glibc-2.12.2; gcc -Wall -Xlinker
-rpath=/opt/$VERSION/lib -Xlinker
-I/opt/$VERSION/lib/ld-linux-x86-64.so.2 loop.c -o loop.12
$ time ./loop.12
real 0m5.218s
user 0m5.210s
sys0 m0.000s
$ time ./loop.13
real 0m8.926s
user 0m8.920s
sys 0m0.010s
$ cat loop.c
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
int main(int argc, char *argv[])
{
int i, j;
char str[100];
char *s;
struct tm t;
strcpy(str, "15/Jul/2012:10:00:00 -0400");
for (i=0; i<5000; i++) {
for (j=0; j<1000; j++) {
s=strptime(str, "%d/%b/%Y:%H:%M:%S", &t);
}
//if (i%10==0) printf("%d\n", i);
}
return 0;
}