Bug 123148 - performance defect of snprintf in glibc
Summary: performance defect of snprintf in glibc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc
Version: 3.0
Hardware: ia64
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 106771 122950
TreeView+ depends on / blocked
 
Reported: 2004-05-13 02:44 UTC by Yiyang Dai
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-09-02 05:57:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:384 0 normal SHIPPED_LIVE Updated glibc packages 2004-09-02 04:00:00 UTC

Description Yiyang Dai 2004-05-13 02:44:02 UTC
Description of problem:
compare to RH AS 2.1 the performance of snprintf is really 
unacceptable in RHEL3(RHEL-U2 has the same problem)

Version-Release number of selected component (if applicable):
RHEL3 U2 
KERNEL 2.4.21-15.EL
glibc-2.3.2-95.20

How reproducible:
a simple testing program
---------------sprintf.c-------------------
#include "stdio.h"
#include "unistd.h"
#include "sys/time.h"


unsigned int GetTickCount()
{
        struct timespec tp;
        unsigned int tt;
        clock_gettime(&tp);
        tt = tp.tv_sec*1000+tp.tv_nsec/1000000;
        return(tt);
}
int clock_gettime( struct timespec *tp)
{
        struct timeval tv;
        gettimeofday(&tv, NULL);
        tp->tv_sec = tv.tv_sec;
        tp->tv_nsec = tv.tv_usec*1000;
        return 0;
}



main(){
        char buf[1024];
        int x=234234;
        unsigned int count1,count2,count3;
        int i;

        count1=GetTickCount();
        for (i=0;i<1000000;i++)
        sprintf
(buf,"sfsdfasdfasdfasdfas;ja;sdjf;lakjsdfkasfkasasdofas;fw.nxzvohpowsy
erqnwoirhasknfasdfhoaudfoizxcvnfasdfasfasdfasdfasdfasdf%d",x);

        count2=GetTickCount();
        count3=count2-count1;

        printf("%u msec used\n",count3);
}

---------------sprintf.c-------------------
Steps to Reproduce:
compile with gcc or intel's icc

results:
on RH AS 2.1 the result is 1395 msec
but on RHEL3 & RHEL3-U2 the result is 5243 msec

on RH AS 2.1 if compile the testing code with -static ( static link 
the glibc-2.2.4-29.2 ) , and move the binary to RHEL3 , the result 
will be 1385 msec which seems ok.




Additional info:

both RH AS2.1 & RHEL3(RHEL3-U2) running on hp rx26000 (2x1.5GHz 
Itanium2 )

Comment 2 Yiyang Dai 2004-05-17 00:39:17 UTC
have tried , about 5x performance improved . when will this be 
mergered to officical release ? U3 ?

Comment 3 Jakub Jelinek 2004-05-17 07:13:43 UTC
Should go into FC3, RHEL3/U3 and RHEL4 b1.

Comment 5 Jakub Jelinek 2004-06-24 19:06:04 UTC
The patch is in glibc-2.3.2-95.21.

Comment 6 Jay Turner 2004-08-20 12:10:02 UTC
Performance with 2.3.2-95.26 is vastly improved.  Moving to modified
and will release as part of the U3 errata.

Comment 7 Jay Turner 2004-09-02 05:57:32 UTC
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-384.html



Note You need to log in before you can comment on or make changes to this bug.