Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vbvmde$3c7ti$2@paganini.bofh.team>
Deutsch   English   Français   Italiano  
<vbvmde$3c7ti$2@paganini.bofh.team>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: Waldek Hebisch <antispam@fricas.org>
Newsgroups: comp.lang.c
Subject: Re: Top 10 most common hard skills listed on resumes...
Date: Thu, 12 Sep 2024 21:28:16 -0000 (UTC)
Organization: To protect and to server
Message-ID: <vbvmde$3c7ti$2@paganini.bofh.team>
References: <vab101$3er$1@reader1.panix.com>   <vbl3am$228vv$1@dont-email.me> <vblfgb$2dkij$1@paganini.bofh.team> <vblhp7$249ug$1@dont-email.me> <vbloje$2e34o$1@paganini.bofh.team> <vbmeae$2bn2v$2@dont-email.me> <vbn8pe$2g9i6$2@paganini.bofh.team> <vbnaqt$2g0vc$1@dont-email.me> <vbnre4$2h8k3$1@paganini.bofh.team> <vbor2f$2qqt1$1@dont-email.me> <vbpj6o$2orhf$1@paganini.bofh.team> <vbpl36$30c4v$2@dont-email.me> <vbtatt$33hat$1@paganini.bofh.team> <vbuk84$7chj$1@dont-email.me>
Injection-Date: Thu, 12 Sep 2024 21:28:16 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3547058"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Notice: Filtered by postfilter v. 0.9.3
Bytes: 4193
Lines: 56

David Brown <david.brown@hesbynett.no> wrote:
> On 12/09/2024 01:59, Waldek Hebisch wrote:
>> David Brown <david.brown@hesbynett.no> wrote:
>>>
>>> On many cpus, using sizes smaller than the full register size means
>>> doing sign extensions or masking operations at various times - thus full
>>> size register operations can often be more efficient.  On such systems
>>> you will find that int_fast16_t is 32-bit or 64-bit, according to the
>>> register width.  On other cpus, some common ALU operations on full-size
>>> operands can be slower than for smaller operands (such as on the 68000).
>>>   There, int_fast16_t will be 16-bit.
>>>
>>> Compiler authors know what will usually be faster on the target.  There
>>> will always be some exceptions (division is usually faster on smaller
>>> operands, for example).  But if you don't know the target - as is the
>>> case of portable code - the compiler will usually make a better choice
>>> here than you would.
>> 
>> BTW, I just played with Clang 18 on 64-bit FreeBSD.  It has 32-bit
>> int_fast16_t.  gcc in Linux makes it 64-bit.  Who is right?
>> 
> 
> Technically, both are right - implementations can use any integer type 
> of at least 16 bits here, whatever they think is fastest in general. 
> But it surprises me somewhat, given that clang for x86-64 on Linux uses 
> 64-bit for int_fast16_t.

Well, both satisfy "hard" requirements.  But the question was which
type is faster.

> But to be clear, the size of the "fast" types depends on the target and 
> the implementation.  They are not normally used for external ABI's, and 
> are purely internal to the generated code.  Obviously you must pick a 
> "fast" size that is at least as big as the range you need.

I think that Linux (and probably FreeBSD too) considers size of
fast type as part of ABI (regardless of gudelines those types
certainly leaked into "public" interfaces).  Such ABI change is
probably viewed as not worth doing.

And concering choice on x86_64, AFAIK for operations on numbers of
the same size 32-bit gives fastest operations.  16-bit had two
disadvantages, big one due to partial register stalls, small one
due to larger size (operand size prefix).  64-bit requires bigger
code (more need to use prefixes) and bigger data.  When mixing
types, 32-bit numbers are automatically zero extended, so there
is no extra cost when mixing unsigend numbers.  So what remains
is mixing signed 32-bit integers with 64-bit ones.  Addresses
use 64-bit artitmetic, so that requires sign extention.  OTOH
in arithmetic "fast" types are likely to be mixed with exact
32-bit types and then making "fast" types 32-bit is faster
overall.  So, there are bets/assumptions which usage is more
frequent.  OTOH, choice between 32-bit and 64-bit fast types
is unlikely to make _much_ difference.

-- 
                              Waldek Hebisch