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: arnold
Subject: Re: [bug-gawk] mktime UTC extremely slow (new in GAWK 4.2)
Date: Tue, 11 Dec 2018 07:34:31 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

Thanks for the report. On a Linux system I see that with the 2nd
argument it's about 5 times slower than without, but not 130
times slower.

At first I thought that it was because you passed a string instead of
a number like 1, but that didn't make a difference.

I conclude that this is a Cygwin issue; I suggest that you report it
on the Cygwin mailing list.

You could perhaps attempt to replicate by timning a C program that calls
mktime() vs. mktime_tz(), and then gawk is out of the picture.

Thanks,

Arnold

"Thorsten Kampe" <address@hidden> wrote:

> [GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1-p11, GNU MP 6.1.2) on Cygwin]
>
> Hello,
>
> the new option[1] to `mktime` is extremely slow (130 seconds on my machine):
>
> ```
> > time gawk -f test1.awk
> gawk -f test.awk  15,09s user 114,19s system 99% cpu 2:09,78 total
> ```
> ```test1.awk
> BEGIN {
> for (i = 1; i <= 100000; i++) {
>     mktime("2000 01 01 00 00 00", "UTC")
> }
> }
> ```
>
> In contrast, not requesting UTC, takes less than one second:
> ```
> > time gawk -f test2.awk
> awk -f test.awk  0,75s user 0,05s system 98% cpu 0,810 total
> ```
> ```test2.awk
> BEGIN {
> for (i = 1; i <= 100000; i++) {
>     mktime("2000 01 01 00 00 00")
> }
> }
> ```
>
> This is on Cygwin. Unfortunately, I don't have a Linux machine with GNU AWK 
> 4.2
>
> Regards, Thorsten
>
> [1] "Add optional 2nd argument to mktime to request UTC instead of local 
> time" 
> (http://git.savannah.gnu.org/cgit/gawk.git/commit/?id=d564505f72518910bfb835a53b697d64613b6240)



reply via email to

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