bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] mktime UTC extremely slow (new in GAWK 4.2)


From: Andrew J. Schorr
Subject: Re: [bug-gawk] mktime UTC extremely slow (new in GAWK 4.2)
Date: Tue, 11 Dec 2018 14:00:25 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Dec 11, 2018 at 11:49:25AM -0500, Andrew J. Schorr wrote:
> In other words, would it help to apply the attached patch?
> On Linux, the execution time for the 2 test cases is about the same
> after applying this patch. Does it make any difference on Cygwin?

I should have included the timing results.

bash-4.2$ head /tmp/test?.awk
==> /tmp/test1.awk <==
BEGIN {
for (i = 1; i <= 100000; i++) {
    mktime("2000 01 01 00 00 00", "UTC")
}
}

==> /tmp/test2.awk <==
BEGIN {
for (i = 1; i <= 100000; i++) {
    mktime("2000 01 01 00 00 00")
}
}

With the unpatched version of gawk on my linux system:

bash-4.2$ time ./gawk -f /tmp/test1.awk

real    0m1.941s
user    0m0.853s
sys     0m1.076s
bash-4.2$ time ./gawk -f /tmp/test2.awk

real    0m0.084s
user    0m0.082s
sys     0m0.002s

And with the patched version using timegm:

bash-4.2$ time ./gawk -f /tmp/test1.awk

real    0m0.087s
user    0m0.084s
sys     0m0.002s
bash-4.2$ time ./gawk -f /tmp/test2.awk

real    0m0.090s
user    0m0.086s
sys     0m0.003s

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]