byte and short data types use cases

Cecil Ward cecil at cecilward.com
Sat Jun 10 22:04:55 UTC 2023


On Saturday, 10 June 2023 at 21:58:12 UTC, Cecil Ward wrote:
> On Friday, 9 June 2023 at 15:07:54 UTC, Murloc wrote:
>> On Friday, 9 June 2023 at 12:56:20 UTC, Cecil Ward wrote:
>>> [...]
>>
>> Is this some kind of property? Where can I read more about 
>> this?

My last example is comms. Protocol headers need economical narrow 
data types because of efficiency, it’s all about packing as much 
user data as possible into each packet and fatter, longer headers 
reduce the amount of user data as the total has a hard limit on 
it. A pair of headers totalling 40 bytes in IPv4+TCP takes up 
nearly 3% of the total length allowed, so that’s a ~3% speed 
loss, as the headers are just dead weight. So here narrow types 
help comms speed.


More information about the Digitalmars-d-learn mailing list