bug-gawk
[Top][All Lists]
Advanced

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

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


From: Thorsten Kampe
Subject: [bug-gawk] mktime UTC extremely slow (new in GAWK 4.2)
Date: Tue, 11 Dec 2018 06:54:32 -0500
User-agent: Cyrus-JMAP/3.1.5-681-g8713b31-fmstable-20181205v1

[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]