From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 0A8E41F9FD for ; Sat, 6 Mar 2021 16:57:03 +0000 (UTC) Received: from localhost ([::1]:43036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIaEf-0004zD-R9 for normalperson@yhbt.net; Sat, 06 Mar 2021 11:57:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIaET-0004rs-O6 for bug-gnulib@gnu.org; Sat, 06 Mar 2021 11:56:49 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIaEP-0003Qm-9s for bug-gnulib@gnu.org; Sat, 06 Mar 2021 11:56:49 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 774AD16015B; Sat, 6 Mar 2021 08:56:42 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 0OLJi3uAjLju; Sat, 6 Mar 2021 08:56:41 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A9E9A16015D; Sat, 6 Mar 2021 08:56:41 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 60wR-VO-0JYl; Sat, 6 Mar 2021 08:56:41 -0800 (PST) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 7D98716015B; Sat, 6 Mar 2021 08:56:41 -0800 (PST) To: Bruno Haible References: <20210303002855.5819-1-eggert@cs.ucla.edu> <14551115.F8Qjx3YMge@omega> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: single-threaded optimizations Message-ID: Date: Sat, 6 Mar 2021 08:56:40 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <14551115.F8Qjx3YMge@omega> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gnulib bugs Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On 3/2/21 7:27 PM, Bruno Haible wrote: > a general macro won't cut it e.g. for coreutils. coreutils > has multithreaded programs ('sort') next to single-threaded programs. > But coreutils wants to optimize wcwidth. GNULIB_WCHAR_SINGLE actually > means "assume that the locale has been set before the program becomes > multithreaded, and won't change afterwards". Similarly, > '#include "unlocked-io.h"' does not mean that the program is single- > threaded; it means that no FILE object is being accessed in more than > one thread. Good point. How about this idea? * We establish a new macro GNULIB_MBTOWC_SINGLE which means "assume that=20 at most one thread invokes mbtowc-like functions". The mbtowc=20 replacement uses this instead of using USE_UNLOCKED_IO. Tar can #define=20 this new macro. * If macros like GNLIB_MBTOWC_SINGLE proliferate, we can have a single=20 macro GNULIB_SINGLE_THREADED that implies all the other macros. For now=20 I'm not sure it's worth the bother to do this. * If someone has the time, fix the underlying problem that the Gnulib=20 mbrtowc replacement doesn't link under AIX in some circumstances, unless=20 you #define GNULIB_MBTOWC_SINGLE. I'm not sure exactly what these=20 circumstances are, and anyway if I were to delve into that, I think I=20 might want to investigate the possibility of having the mbrtowc=20 replacement use AIX mbrtowc instead of a lock around AIX mbtowc, as that=20 should perform better anyway. But I'm not sure AIX is worth the time for=20 this sort of thing.