Re: [PATCH 05/16] system_data_types.7: Add int_fastN_t family of types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 1 Oct 2020 at 12:15, Alejandro Colomar <colomar.6.4.3@xxxxxxxxx> wrote:
>
>
>
> On 2020-10-01 13:07, Jonathan Wakely wrote:
> [...]
> >> +Notes:
> >> +Some of these types may be optimized for size
> >> +instead of raw performance.
> >
> > I'm not sure what this tells me as a programmer. What does "raw
> > performance" means exactly? The text above says it's "the fastest",
> > but then it says "may be optimized for size". I don't know how to
> > interpret this. Is it fast or is it small, or something else? Is it
> > optimized for small size? Natural word size? Cacheline size?
> >
> > I prefer the phrasing of the caveats in the C and POSIX standards
> > which just say it might not be fastest for all purposes.
> >
> > How about "Where there is no single type that is fastest for all
> > purposes, the implementation may choose any type with the required
> > signedness and at least the minimum width."
> >
> > I don't see anything in this man page saying that the <stdint.h> types
> > are all typedefs, rather than new types that are distinct from the
> > standard integer types. That seems like useful information.
> >
>
> Hi Jonathan,
>
> I wasn't sure about how to word it.
>
> In theory, they should be the fastest types; just that.
> But then, for some reason, GCC decided that
> int_fast8_t should be int8_t instead of int64_t,
> because when using arrays of int_fast8_t,
> it will create smaller arrays, which will be faster (less cache, etc.).
>
> (I remember having read that a long time ago, but I don't remember the
> source, or if it's the actual reason).

So then that's still optimized for "raw performance", isn't it? The
"raw performance" of copying an array of bytes is better than the "raw
performance" of copying an array of 64-bit types. The meaning of "raw
performance" depends on what you're doing, so I don't think it's a
useful term without context.

> How would you word that?

I gave a suggestion above.

Don't use terms like "raw performance" that are meaningless without
context. Using "no single type that is fastest for all purposes" makes
it clearer that "fastest" isn't something universally true, it might
be fastest for some purposes and not others.



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux