On 18 Nov 2020, at 22:32, Stefan Esser <s...@freebsd.org> 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

_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to