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=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 D10A11F9FD for ; Wed, 3 Mar 2021 03:28:11 +0000 (UTC) Received: from localhost ([::1]:41864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHIBH-0000WX-0j for normalperson@yhbt.net; Tue, 02 Mar 2021 22:28:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHIBE-0000WJ-KU for bug-gnulib@gnu.org; Tue, 02 Mar 2021 22:28:08 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.54]:27282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHIBD-0005Do-09 for bug-gnulib@gnu.org; Tue, 02 Mar 2021 22:28:08 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1614742076; cv=none; d=strato.com; s=strato-dkim-0002; b=fpqKI6clonF+c0QmR8n/aE6xbSne/jN8X2hQX0qfwf/mFh+BJIqnFnsE0Wf3HQVqI6 u5UhYqEmI/9Nqhz7zkvkahDdTwBh7YkCpsQ6MzFXrrCDGJu/Pnb9daPmz402IZ05oLi0 QO1SCQBHFSbyDa1T3bnkgkzCdlHk4oXJRi8CYCrJZIt31gSU9TsdcAcRAit/iiTRRKkP zqjX3f2U7SogyByPc4SRk+YZGSYSQj8/GoKPawoPosndkII+Zue6TbP9GHpv8q/LBzwk TIC8Gv+fL37V13QacRfM8y8nTHuukTVLr5sMJPCUZOpggL7PszgSBseTI9ZAS3vSp9+B 1uiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1614742076; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4gtA1s3e0lERxeEboA0S2qn69E0Mz6WkROaqdRpUmdU=; b=rZxorKM6zrHgrPW9m+G+zLsfJjDyqaA9iD6szjx7Fbk/NC7cyemzJ1I8/cpPe1/g6n b+M05W+pP1yxoS8CkwajInqlPsmAJNm3vxT0BHkPtdVhg8qawtTs35pN3x9dH0/AtgVn gY5uZNRhLDQT5/Bq91xsFxVCDdv6uU3cphBNU6NssHrgEiArx7IbyN5W1t1WGY/b6C0d aY4bhdzkqJD5LMwQyf1G1OeMD7f4ZWBCq2k2ILdhiKn6U+75w46Qxlim8Ufa4JhhM0pZ 0NbNPAvVoukFvWVsha4yFJg2HE3wV97FDpc9AAPe90wH9UKfC5SPdtlGKLX8JRaSwjZt f5Hg== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1614742076; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4gtA1s3e0lERxeEboA0S2qn69E0Mz6WkROaqdRpUmdU=; b=QfsK6MRdPV/nb6F1AxT8gqBlwTMi5Foay9PfXC2mNROH0C5Fw5HYS3FEsc1mNoYubh An/FGsJ7AqrZqsfL8Zz1Y+iv4TGKizBzHL2HqOwKj4byeDaNOkIglUgx4mwszkhtXaJW NnJjTErBxZXsrUGCYc6XTgOIcIW8RFGAqcnLnATi4do2rhVl11vCHYoGeOVMg7m5OPeo opHM/w99th+kYOheReJogym5MHzhwuZeB/OwD0jOl3xv/YAgGxy7fISfr43FyJvP7afy l0DPcCo7R6n/D2X3POtGbzwqyylXCyBKMh8z6yny0TWObqH2m1skdmixrODLKsx00jsQ r/eg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6f3yJZW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.20.2 DYNA|AUTH) with ESMTPSA id V08841x233RuBM4 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Wed, 3 Mar 2021 04:27:56 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: single-threaded optimizations Date: Wed, 03 Mar 2021 04:27:56 +0100 Message-ID: <14551115.F8Qjx3YMge@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20210303002855.5819-1-eggert@cs.ucla.edu> References: <20210303002855.5819-1-eggert@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Received-SPF: none client-ip=85.215.255.54; envelope-from=bruno@clisp.org; helo=mo4-p01-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=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: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi Paul, Paul Eggert wrote: > + * lib/mbtowc-lock.h (mbtowc_with_lock) [USE_UNLOCKED_IO]: > + Don=E2=80=99t bother with locks, since this app is single-threade= d. We now have two C macros which indicate a single-threaded application: * USE_UNLOCKED_IO, used - for unlocked - in regex - in mbrtowc * GNULIB_WCHAR_SINGLE, used in wcwidth. This gets weirder over time. Should we have one macro for each of gnulib's facilities (stdio, regex, multibyte/wchar)? Or should we have one macro in general? In this case I would suggest to choose a more generic name, instead of USE_UNLOCKED_IO. Recall that 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. What do you think? Bruno