public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/15943] New: localtime_r performance drop when set different timezone
@ 2013-09-11  2:20 qd.feng@alcatel-lucent.com
  2013-09-11  8:02 ` [Bug libc/15943] " schwab@linux-m68k.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: qd.feng@alcatel-lucent.com @ 2013-09-11  2:20 UTC (permalink / raw)
  To: glibc-bugs

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(&ltime);
 13
 14                   localtime_r(&ltime, &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.


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

* [Bug libc/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
@ 2013-09-11  8:02 ` schwab@linux-m68k.org
  2013-09-11  8:16 ` qd.feng@alcatel-lucent.com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: schwab@linux-m68k.org @ 2013-09-11  8:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
How do you set the timezone?

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


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

* [Bug libc/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
  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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: qd.feng@alcatel-lucent.com @ 2013-09-11  8:16 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

--- Comment #2 from Steven Feng <qd.feng@alcatel-lucent.com> ---
link the /etc/localtime to time zone under usr/share/zoneinfo/
e.g. 
ln -sf /usr/share/zoneinfo/America/New_York  /etc/localtime

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


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

* [Bug libc/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 12:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

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


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

* [Bug time/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
                   ` (2 preceding siblings ...)
  2014-06-13 12:50 ` fweimer at redhat dot com
@ 2015-08-27 22:17 ` jsm28 at gcc dot gnu.org
  2023-01-11  2:41 ` eggert at cs dot ucla.edu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-08-27 22:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libc                        |time

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


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

* [Bug time/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: eggert at cs dot ucla.edu @ 2023-01-11  2:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

eggert at cs dot ucla.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eggert at cs dot ucla.edu

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

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

* [Bug time/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: yann at droneaud dot fr @ 2023-01-11  9:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

Yann Droneaud <yann at droneaud dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yann at droneaud dot fr

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

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

* [Bug time/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: eggert at cs dot ucla.edu @ 2023-01-11 19:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

--- Comment #5 from eggert at cs dot ucla.edu ---
This glibc performance bug came up recently on the tz mailing list; see the
thread "[tz] localtime_r multiple times slower for Europe/Moscow timezone"
starting here:

https://mm.icann.org/pipermail/tz/2023-January/032522.html

That thread stems from the following Ubuntu bug report:

https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/868395

Guy Harris diagnosed the problem as glibc not properly caching the expansion of
the TZ string at the end of the TZif file. See:

https://mm.icann.org/pipermail/tz/2023-January/032529.html

This problem has grown in importance as many jurisdictions are now like Moscow,
as they formerly had daylight saving but now no longer do. So this performance
bug is more important now than it was years ago.

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

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

* [Bug time/15943] localtime_r performance drop when set different timezone
  2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
                   ` (6 preceding siblings ...)
  2023-01-11 19:17 ` eggert at cs dot ucla.edu
@ 2023-01-12  0:43 ` gharris at sonic dot net
  7 siblings, 0 replies; 9+ messages in thread
From: gharris at sonic dot net @ 2023-01-12  0:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15943

Guy Harris <gharris at sonic dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gharris at sonic dot net

--- Comment #6 from Guy Harris <gharris at sonic dot net> ---
Most if not all of China and India are also now no longer on DST, which is why
it happens with Asia/Shanghai.

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

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

end of thread, other threads:[~2023-01-12  0:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-11  2:20 [Bug libc/15943] New: localtime_r performance drop when set different timezone qd.feng@alcatel-lucent.com
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

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).