Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The less time planning, the more time programming.


computers / comp.os.vms / setlocale() is extremely slow

SubjectAuthor
* setlocale() is extremely slowJake Hamby
+* Re: setlocale() is extremely slowJohn Reagan
|`- Re: setlocale() is extremely slowCraig A. Berry
`- Re: setlocale() is extremely slowVitaly Pustovetov

1
setlocale() is extremely slow

<45b2c93b-6952-4cee-90a2-f0cf23f5c8fdn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=23052&group=comp.os.vms#23052

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ae9:ed96:0:b0:6a3:634c:76dc with SMTP id c144-20020ae9ed96000000b006a3634c76dcmr884185qkg.111.1654112936458;
Wed, 01 Jun 2022 12:48:56 -0700 (PDT)
X-Received: by 2002:a05:622a:104c:b0:2fc:4d41:386 with SMTP id
f12-20020a05622a104c00b002fc4d410386mr1142797qte.293.1654112936267; Wed, 01
Jun 2022 12:48:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Wed, 1 Jun 2022 12:48:55 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:46b0:abc0:6365:ea27:da71:690c;
posting-account=OGFVHQoAAAASiNAamRQec8BtkuXxYFnQ
NNTP-Posting-Host: 2600:1700:46b0:abc0:6365:ea27:da71:690c
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <45b2c93b-6952-4cee-90a2-f0cf23f5c8fdn@googlegroups.com>
Subject: setlocale() is extremely slow
From: jake.ha...@gmail.com (Jake Hamby)
Injection-Date: Wed, 01 Jun 2022 19:48:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3938
 by: Jake Hamby - Wed, 1 Jun 2022 19:48 UTC

I don't want to resurrect the long off-topic thread that started out asking about writing Icelandic words in a DECterm, but I do have something to add to the topic of ISO-8859 and UTF-8 on OpenVMS.

I've been working on updating the GNV ports, starting from the latest Mercurial versions, and then patching to use __NEW_STARLET and the latest C99 features from V8.4-2L1 (+ the CRTL C99 ECO), since both are now available to hobbyists. Finally, a C99 version of <stdint.h> and other functions I've been wanting for 20 years.

When it came time to test how well bash 4.4.23 worked after my patches and updates, I discovered that one self-test was extremely slow and CPU-bound. Profiling it, I found that 90% of the entire CPU time was spent in setlocale(), because bash apparently likes to call setlocale() to save and restore the LC_* settings, a lot.

I realized that I'd previously defined SYS$LC_ALL to "EN_US_ISO8859-1-EURO" in my sylogicals .com, so I figured I could undefine that and that the default built-in "C" locale would be much faster, and that's exactly what I found. Returning to the default locale made the calls to setlocale() vanish into the noise.

I did discover that the DECC$LOCALE_CACHE_SIZE feature does absolutely nothing worthwhile, whether I set it to 1MB, 10MB, or 100MB. I also tried setting "UTF8-50" as a locale, but I had problems with earlier test cases when I did that. I can't imagine it'd be faster.

This is on Alpha, so I'll test later if this issue was fixed in 8.4-2L3 on I64. As it is, I'd be wary of setting my user locale to anything but "C", much less the system locale as I'd been doing.

GNV bash has many hacks to avoid spawning subprocesses, and one of them is to save/restore its own environment when calling other shell scripts, rather than fork()'ing a separate shell. As a consequence of that, it's making many, many calls to setlocale(), both to get and to set the locale, so it's not a matter of caching the values that it returns.

Relatedly, when I installed the I18N kit on Alpha, I couldn't start the DECwindows server any more: it would hang at the crosshatch screen because dtlogin wasn't starting. Fortunately, I found a workaround by commenting out the lines that deassigned the system logical DECW$USEXLIBXPG4, which is defined by an earlier startup script (sys$startup:VMS$LPBEGIN-050_STARTUP). So apparently DECW$USEXLIBXPG4 is still required, for some reason, when the locales are installed.

Maybe that bug has been fixed already, because I haven't seen that issue with the I18N package on V8.4-2L3. I've definitely seen it in V8.4, so it's something to be aware of, along with setlocale() being very slow and the locale cache being seemingly useless at speeding repeated calls to it.

Re: setlocale() is extremely slow

<cb65a934-889d-4287-b0f3-3c8f88021b26n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=23059&group=comp.os.vms#23059

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:620a:24cb:b0:6a5:ac26:4819 with SMTP id m11-20020a05620a24cb00b006a5ac264819mr1715247qkn.465.1654133860633;
Wed, 01 Jun 2022 18:37:40 -0700 (PDT)
X-Received: by 2002:a05:620a:40d4:b0:6a6:5398:ce26 with SMTP id
g20-20020a05620a40d400b006a65398ce26mr1699897qko.135.1654133860414; Wed, 01
Jun 2022 18:37:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Wed, 1 Jun 2022 18:37:40 -0700 (PDT)
In-Reply-To: <45b2c93b-6952-4cee-90a2-f0cf23f5c8fdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=47.13.19.218; posting-account=M3IgSwoAAADJd6EnOmsrCCfB6_OyTOkv
NNTP-Posting-Host: 47.13.19.218
References: <45b2c93b-6952-4cee-90a2-f0cf23f5c8fdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cb65a934-889d-4287-b0f3-3c8f88021b26n@googlegroups.com>
Subject: Re: setlocale() is extremely slow
From: xyzzy1...@gmail.com (John Reagan)
Injection-Date: Thu, 02 Jun 2022 01:37:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: John Reagan - Thu, 2 Jun 2022 01:37 UTC

On Wednesday, June 1, 2022 at 3:48:58 PM UTC-4, jake....@gmail.com wrote:
> I don't want to resurrect the long off-topic thread that started out asking about writing Icelandic words in a DECterm, but I do have something to add to the topic of ISO-8859 and UTF-8 on OpenVMS.
>
> I've been working on updating the GNV ports, starting from the latest Mercurial versions, and then patching to use __NEW_STARLET and the latest C99 features from V8.4-2L1 (+ the CRTL C99 ECO), since both are now available to hobbyists. Finally, a C99 version of <stdint.h> and other functions I've been wanting for 20 years.
>
> When it came time to test how well bash 4.4.23 worked after my patches and updates, I discovered that one self-test was extremely slow and CPU-bound.. Profiling it, I found that 90% of the entire CPU time was spent in setlocale(), because bash apparently likes to call setlocale() to save and restore the LC_* settings, a lot.
>
> I realized that I'd previously defined SYS$LC_ALL to "EN_US_ISO8859-1-EURO" in my sylogicals .com, so I figured I could undefine that and that the default built-in "C" locale would be much faster, and that's exactly what I found. Returning to the default locale made the calls to setlocale() vanish into the noise.
>
> I did discover that the DECC$LOCALE_CACHE_SIZE feature does absolutely nothing worthwhile, whether I set it to 1MB, 10MB, or 100MB. I also tried setting "UTF8-50" as a locale, but I had problems with earlier test cases when I did that. I can't imagine it'd be faster.
>
> This is on Alpha, so I'll test later if this issue was fixed in 8.4-2L3 on I64. As it is, I'd be wary of setting my user locale to anything but "C", much less the system locale as I'd been doing.
>
> GNV bash has many hacks to avoid spawning subprocesses, and one of them is to save/restore its own environment when calling other shell scripts, rather than fork()'ing a separate shell. As a consequence of that, it's making many, many calls to setlocale(), both to get and to set the locale, so it's not a matter of caching the values that it returns.
>
> Relatedly, when I installed the I18N kit on Alpha, I couldn't start the DECwindows server any more: it would hang at the crosshatch screen because dtlogin wasn't starting. Fortunately, I found a workaround by commenting out the lines that deassigned the system logical DECW$USEXLIBXPG4, which is defined by an earlier startup script (sys$startup:VMS$LPBEGIN-050_STARTUP). So apparently DECW$USEXLIBXPG4 is still required, for some reason, when the locales are installed.
>
> Maybe that bug has been fixed already, because I haven't seen that issue with the I18N package on V8.4-2L3. I've definitely seen it in V8.4, so it's something to be aware of, along with setlocale() being very slow and the locale cache being seemingly useless at speeding repeated calls to it.
I'll have somebody look at it.

Re: setlocale() is extremely slow

<t7bnv7$9pp$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=23070&group=comp.os.vms#23070

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: craigbe...@nospam.mac.com (Craig A. Berry)
Newsgroups: comp.os.vms
Subject: Re: setlocale() is extremely slow
Date: Thu, 2 Jun 2022 20:25:58 -0500
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <t7bnv7$9pp$1@dont-email.me>
References: <45b2c93b-6952-4cee-90a2-f0cf23f5c8fdn@googlegroups.com>
<cb65a934-889d-4287-b0f3-3c8f88021b26n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 3 Jun 2022 01:26:00 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2a6d0494005a6a820e478255e2e9bd41";
logging-data="10041"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LJsGhxNV8yjbsUTghaI71hMyvFoVZIRU="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.9.1
Cancel-Lock: sha1:m70HzksRFKyDb1QQSYIUQwM+8Kc=
In-Reply-To: <cb65a934-889d-4287-b0f3-3c8f88021b26n@googlegroups.com>
Content-Language: en-US
 by: Craig A. Berry - Fri, 3 Jun 2022 01:25 UTC

On 6/1/22 8:37 PM, John Reagan wrote:
> On Wednesday, June 1, 2022 at 3:48:58 PM UTC-4, jake....@gmail.com wrote:
>> I don't want to resurrect the long off-topic thread that started out asking about writing Icelandic words in a DECterm, but I do have something to add to the topic of ISO-8859 and UTF-8 on OpenVMS.
>>
>> I've been working on updating the GNV ports, starting from the latest Mercurial versions, and then patching to use __NEW_STARLET and the latest C99 features from V8.4-2L1 (+ the CRTL C99 ECO), since both are now available to hobbyists. Finally, a C99 version of <stdint.h> and other functions I've been wanting for 20 years.
>>
>> When it came time to test how well bash 4.4.23 worked after my patches and updates, I discovered that one self-test was extremely slow and CPU-bound. Profiling it, I found that 90% of the entire CPU time was spent in setlocale(), because bash apparently likes to call setlocale() to save and restore the LC_* settings, a lot.
>>
>> I realized that I'd previously defined SYS$LC_ALL to "EN_US_ISO8859-1-EURO" in my sylogicals .com, so I figured I could undefine that and that the default built-in "C" locale would be much faster, and that's exactly what I found. Returning to the default locale made the calls to setlocale() vanish into the noise.
>>
>> I did discover that the DECC$LOCALE_CACHE_SIZE feature does absolutely nothing worthwhile, whether I set it to 1MB, 10MB, or 100MB. I also tried setting "UTF8-50" as a locale, but I had problems with earlier test cases when I did that. I can't imagine it'd be faster.
>>
>> This is on Alpha, so I'll test later if this issue was fixed in 8.4-2L3 on I64. As it is, I'd be wary of setting my user locale to anything but "C", much less the system locale as I'd been doing.
>>
>> GNV bash has many hacks to avoid spawning subprocesses, and one of them is to save/restore its own environment when calling other shell scripts, rather than fork()'ing a separate shell. As a consequence of that, it's making many, many calls to setlocale(), both to get and to set the locale, so it's not a matter of caching the values that it returns.
>>
>> Relatedly, when I installed the I18N kit on Alpha, I couldn't start the DECwindows server any more: it would hang at the crosshatch screen because dtlogin wasn't starting. Fortunately, I found a workaround by commenting out the lines that deassigned the system logical DECW$USEXLIBXPG4, which is defined by an earlier startup script (sys$startup:VMS$LPBEGIN-050_STARTUP). So apparently DECW$USEXLIBXPG4 is still required, for some reason, when the locales are installed.
>>
>> Maybe that bug has been fixed already, because I haven't seen that issue with the I18N package on V8.4-2L3. I've definitely seen it in V8.4, so it's something to be aware of, along with setlocale() being very slow and the locale cache being seemingly useless at speeding repeated calls to it.
> I'll have somebody look at it.

David Jones discovered some years ago that strerror() has similar
problems. Every invocation hunts through a search list to find, open,
read from, and close the locale-specific message catalog file.

Re: setlocale() is extremely slow

<3a22bb8a-87b5-4ec2-bb4d-025111576f37n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=23147&group=comp.os.vms#23147

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:5bd1:0:b0:304:efba:972d with SMTP id b17-20020ac85bd1000000b00304efba972dmr23170760qtb.635.1654946967604;
Sat, 11 Jun 2022 04:29:27 -0700 (PDT)
X-Received: by 2002:a05:620a:108d:b0:6a6:c888:ce6c with SMTP id
g13-20020a05620a108d00b006a6c888ce6cmr19314121qkk.739.1654946967438; Sat, 11
Jun 2022 04:29:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Sat, 11 Jun 2022 04:29:27 -0700 (PDT)
In-Reply-To: <45b2c93b-6952-4cee-90a2-f0cf23f5c8fdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=188.242.128.41; posting-account=MdFUXgoAAAA4RFSe0GdwtymAGVxcBpnA
NNTP-Posting-Host: 188.242.128.41
References: <45b2c93b-6952-4cee-90a2-f0cf23f5c8fdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a22bb8a-87b5-4ec2-bb4d-025111576f37n@googlegroups.com>
Subject: Re: setlocale() is extremely slow
From: pustove...@gmail.com (Vitaly Pustovetov)
Injection-Date: Sat, 11 Jun 2022 11:29:27 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2061
 by: Vitaly Pustovetov - Sat, 11 Jun 2022 11:29 UTC

OK. I've sended a patch for the issue to QA. So if everything goes well, then the patch will be in the next CRTL ECO kit.

Suite: testlocale_long
Test: testlocale() ...passed
Test: testlocale_cache() ...passed

Run Summary - Run Failed Inactive Skipped
Suites : 1 0 0 0
Asserts : 200006 0 n/a n/a
Tests : 2 0 0 0

Elapsed Time: 38.430(s)

and after the patch
$ define DECC$SHR WORK:[XXX.ACRTL.BIN]DECC$SHR.EXE

Suite: testlocale_long
Test: testlocale() ...passed
Test: testlocale_cache() ...passed

Run Summary - Run Failed Inactive Skipped
Suites : 1 0 0 0
Asserts : 200006 0 n/a n/a
Tests : 2 0 0 0

Elapsed Time: 0.470(s)


computers / comp.os.vms / setlocale() is extremely slow

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor