From owner-svn-src-head@freebsd.org Wed Nov 18 22:39:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4483E473EF8 for ; Wed, 18 Nov 2020 22:39:48 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CbyRl6mhTz4ljF for ; Wed, 18 Nov 2020 22:39:47 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f52.google.com with SMTP id c17so4056783wrc.11 for ; Wed, 18 Nov 2020 14:39:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=N66VAkAocw1qZbK3eS/N9o9Tcvf/wwctRyqZleDwFY8=; b=LyPZhuV2NwHecJKmeaUbGNJxYXMiwSlc0r4yPPfu66VN/8pKQ6eH/rvav5VpNIYa1b J/DxgtG1Ch5vZw7+IJLaCxbVGDkl17KobA+hgyOvzYXiIBBoYQUbphOOSQASRogKmhuQ ex/Aesl2G1LV+SNJFnBQXqqY3uQiQLZfPZQEphRMQNpN9IpCbq3b4N66OURoWe5KlZ4i 6F2kqUwafttAnORDKkRiAYKRvrpZ2JPZKoogbtmyGaFsHqNNik4FOi6gW+iJU3WTjtQV L4MA+H8UlqeyMjdkboi2EGWr/oQpusmpt7ONeg6BDGiD6LS+iw9drlU2RZfdVBAh4OVl BKxA== X-Gm-Message-State: AOAM530qPFWaS3XRBjArN5o8UC7UunQq8NNHtmFSVsYG8FVik4xJfIWp c/97qj2OcHTeTxIIfJiC1cZ1UA== X-Google-Smtp-Source: ABdhPJyCKs+Jr7LxHYgM3VGyAtFwUZUaQLUpekMEeBgt+GgVbsyG6/hMh6/+KIb/n2zjJdJ9wUgYyA== X-Received: by 2002:adf:e788:: with SMTP id n8mr6833057wrm.84.1605739186246; Wed, 18 Nov 2020 14:39:46 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id t13sm36710644wru.67.2020.11.18.14.39.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2020 14:39:45 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r367813 - head/lib/libutil From: Jessica Clarke In-Reply-To: Date: Wed, 18 Nov 2020 22:39:44 +0000 Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <202011181944.0AIJiUU3003699@repo.freebsd.org> To: Stefan Esser X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CbyRl6mhTz4ljF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2020 22:39:48 -0000 On 18 Nov 2020, at 22:32, Stefan Esser wrote: > > Am 18.11.20 um 22:40 schrieb Mateusz Guzik: >>> +{ >>> + static const int localbase_oid[2] = {CTL_USER, USER_LOCALBASE}; >> There is no use for this to be static. > > Why not? This makes it part of the constant initialized data of > the library, which is more efficient under run-time and memory > space aspects than initializing them on the stack. > > What do I miss? What is more efficient is not so clear-cut, it depends on things like the architecture, microarchitecture and ABI. Allocating a small buffer on the stack is extremely cheap (the memory will almost certainly be in the L1 cache), whereas globally-allocated storage is less likely to be in the cache due to being spread out, and on some architecture/ABI combinations will incur additional indirection through the GOT. Also, 8 bytes of additional stack use is lost in the noise. Jess