public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/15884] New: Big performance regression in strcoll
@ 2013-08-23 16:38 neleai at seznam dot cz
  2013-08-23 17:29 ` [Bug libc/15884] " siddhesh at redhat dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: neleai at seznam dot cz @ 2013-08-23 16:38 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15884

            Bug ID: 15884
           Summary: Big performance regression in strcoll
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: neleai at seznam dot cz
                CC: drepper.fsp at gmail dot com

Hi, 
After looking to strcoll code I noticed glaring performance problems. 
Consider following program:

#include <locale.h>
#include <string.h>
#include <stdlib.h>
int foo(char *a,char *b){
  return strcoll(a,b);
}

int main(){
  setlocale(LC_ALL, "en_US.UTF8");
  int i,f=0;
  char *a=malloc(1000000);
  char *b=malloc(1000000);
  memset(a,32,N); a[N]=0;
  memset(b,33,N); a[N]=0;

  for (i=0;i<1000000;i++)
        f+=foo(a,b);
  return f;
}

As a and b differ in first character we should get O(1) performance, yet I got:

ondra@neklekam:~$ gcc -DN=1 strcoll.c ; time ./a.out

real    0m0.078s
user    0m0.077s
sys    0m0.000s
ondra@neklekam:~$ gcc -DN=10 strcoll.c ; time ./a.out

real    0m0.283s
user    0m0.283s
sys    0m0.000s
ondra@neklekam:~$ gcc -DN=100 strcoll.c ; time ./a.out

real    0m2.016s
user    0m2.013s
sys    0m0.003s

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-11-25 23:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23 16:38 [Bug libc/15884] New: Big performance regression in strcoll neleai at seznam dot cz
2013-08-23 17:29 ` [Bug libc/15884] " siddhesh at redhat dot com
2013-08-23 17:52 ` siddhesh at redhat dot com
2013-08-23 18:26 ` [Bug libc/15884] Big performance problem " neleai at seznam dot cz
2013-08-24  3:48 ` siddhesh at redhat dot com
2013-08-24  5:33 ` neleai at seznam dot cz
2013-08-24 20:20 ` bugdal at aerifal dot cx
2014-06-13 13:04 ` fweimer at redhat dot com
2014-10-17 10:19 ` cvs-commit at gcc dot gnu.org
2014-11-25 23:03 ` neleai at seznam dot cz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).