[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68ccb162-459b-cb95-19cf-3e0335e4c981@molgen.mpg.de>
Date: Tue, 22 Mar 2022 22:02:06 +0100
From: Paul Menzel <pmenzel@...gen.mpg.de>
To: Jakub Kicinski <kuba@...nel.org>,
David Laight <David.Laight@...LAB.COM>
Cc: Wan Jiabing <wanjiabing@...o.com>,
intel-wired-lan@...ts.osuosl.org,
LKML <linux-kernel@...r.kernel.org>, netdev@...r.kernel.org,
Paolo Abeni <pabeni@...hat.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Don't do arithmetic on anything smaller than 'int' (was: [PATCH v2]
ice: use min_t() to make code cleaner in ice_gnss)
Dear Linux folks,
Am 22.03.22 um 19:27 schrieb Jakub Kicinski:
> On Tue, 22 Mar 2022 18:12:08 +0000 David Laight wrote:
>>>> Oh FFS why is that u16?
>>>> Don't do arithmetic on anything smaller than 'int'
>>>
>>> Any reasoning? I don't say it's good or bad, just want to hear your
>>> arguments (disasms, perf and object code measurements) etc.
>>
>> Look at the object code on anything except x86.
>> The compiler has to add instruction to mask the value
>> (which is in a full sized register) down to 16 bits
>> after every arithmetic operation.
>
> Isn't it also slower on some modern x86 CPUs?
> I could have sworn someone mentioned that in the past.
I know of Scott’s article *Small Integers: Big Penalty* from 2012 [1].
Kind regards,
Paul
[1]: https://notabs.org/coding/smallIntsBigPenalty.htm
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@...osl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Powered by blists - more mailing lists