public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "qd.feng@alcatel-lucent.com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/15943] New: localtime_r performance drop when set different timezone Date: Wed, 11 Sep 2013 02:20:00 -0000 [thread overview] Message-ID: <bug-15943-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=15943 Bug ID: 15943 Summary: localtime_r performance drop when set different timezone Product: glibc Version: 2.12 Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: qd.feng@alcatel-lucent.com CC: drepper.fsp at gmail dot com There is one thread in our application frequently call the localtime_r. We found the thread performance has 20% drop when change the timezone from the America/New_york to Asia/Shanghai from the system(Redhat 6,). After profile, we found it is the localtime_r cause the difference. When set the timezone as America/New_york, the __tzfile_compute mainly call the __tzstring. While when set the timezone as the Asia/Shanghai the __tzfile_compute call the __tzset_parse_tz which consume most of the CPU time. I also do an simple test on our HP G8 server. 1 #include <time.h> 2 #include <stdio.h> 3 4 int main(void) 5 { 6 struct tm newtime; 7 time_t ltime; 8 char buf[50]; 9 10 for(int i=0;i<=1000000;i++) 11 { 12 ltime=time(<ime); 13 14 localtime_r(<ime, &newtime); 15 } 16 } After compile and run command time ./a.out with the timezone as Asia/Shanghai or America/New_York. Asia/Shanghai real 0m1.838s user 0m1.628s sys 0m0.206s America/New_York real 0m0.608s user 0m0.395s sys 0m0.211s There is no TZ env been set on both cases. I wonder what causes the performance so difference, is it an designed behavior? Steven -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2013-09-11 2:20 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-09-11 2:20 qd.feng@alcatel-lucent.com [this message] 2013-09-11 8:02 ` [Bug libc/15943] " schwab@linux-m68k.org 2013-09-11 8:16 ` qd.feng@alcatel-lucent.com 2014-06-13 12:50 ` fweimer at redhat dot com 2015-08-27 22:17 ` [Bug time/15943] " jsm28 at gcc dot gnu.org 2023-01-11 2:41 ` eggert at cs dot ucla.edu 2023-01-11 9:28 ` yann at droneaud dot fr 2023-01-11 19:17 ` eggert at cs dot ucla.edu 2023-01-12 0:43 ` gharris at sonic dot net
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-15943-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).