localtime_r multiple times slower for Europe/Moscow timezone
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GLibC |
Confirmed
|
Medium
|
|||
glibc (Ubuntu) |
New
|
Undecided
|
Unassigned | ||
tzdata (Ubuntu) |
Triaged
|
Medium
|
Unassigned |
Bug Description
In version tzdata-2011j (tzdata-2011k also affected) was founded strange bug in russian timezones.
Because of a law "On the Calculation of Time" there were changes in zone like:
3:00 Russia MSK/MSD 2011
changed to:
3:00 Russia MSK/MSD 2011 Mar 27 2:00s
4:00 - MSK
But if no rule used for this change (using "-" instead of rule "Russia"), calling of system function localtime_r() takes more time (takes more than 40% time longer).
I used following code for measuring:
=======
#include <time.h>
#include <stdio.h>
int main() {
time_t t = time(0);
int i;
struct tm result;
for(i=0; i < 10000000; i++)
localtime_r(&t, &result);
puts(ctime(&t));
return 0;
}
=======
and also this sql code in mysql db:
select benchmark(1000000, from_unixtime(
For example, when I'm using new tzdata-2011j results are:
1. time ./a.out (c code)
real 0m5.165s
user 0m5.140s
sys 0m0.000s
2. sql query
mysql> select benchmark(1000000, from_unixtime(
+------
| benchmark(1000000, from_unixtime(
+------
| 0 |
+------
1 row in set (1.03 sec).
And when I'm using old tzdata-2008b:
1. time ./a.out (c code)
real 0m1.675s
user 0m1.450s
sys 0m0.000s
2. sql query
mysql> select benchmark(1000000, from_unixtime(
+------
| benchmark(1000000, from_unixtime(
+------
| 0 |
+------
1 row in set (0.65 sec)
This bug seemed critical on high loaded systems (for example, for databases that using unix timestamps).
My configuration was:
Description: Ubuntu 8.04.1
Release: 8.04
Packages: 2011j~repack-
summary: |
- Bug in Europe/Russia timezones + Slow Europe/Russia timezone |
summary: |
- Slow Europe/Moscow timezone + localtime_r multiple times slower for Europe/Moscow timezone |
affects: | zoneinfo → glibc |
Changed in glibc: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
The attachment "Difference that makes 2011 work better" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.
[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]