Public bug reported:

It seems that unsetting the environment variable TZ there is a huge
performance penalty calling some glibc functions, eg. time()

this has been documented here:

https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-
save-thousands-of-system-calls/

and I can confirm it on an amd64 system running Yakkety:

$ cat time.c
#include <time.h>

int main(int argc, char *argv[])
{
        int i = 0;
        time_t timep;

        for (i = 0; i < 10000000; i++) {
                time(&timep);
                localtime(&timep);
        }

        return 0;
}
$ gcc -Wall -O3 time.c -o time
$ time ./time

real    0m7.102s
user    0m2.060s
sys     0m5.040s
$ time TZ=:/etc/localtime ./time

real    0m0.952s
user    0m0.948s
sys     0m0.000s
$

I've set TZ in /etc/environment to have it globally defined.

** Affects: shadow (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1669055

Title:
  TZ is not set by default

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1669055/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to