[PATCH] time: Avoid alignment gaps in __tzfile_read

Florian Weimer fweimer@redhat.com
Sun Feb 3 08:34:00 GMT 2019


* Florian Weimer:

> * Paul Eggert:
>
>> Florian Weimer wrote:
>>> By ordering the suballocations by decreasing alignment, alignment
>>> gaps can be avoided.
>>>
>>> ... In the 8-byte case, two reads are now needed because the
>>> transitions and type indexes are no longer adjacent.
>>
>> Is the idea to slightly decrease the amount of memory used, at the
>> expense of a slight increase in CPU time because of the two fread
>> calls?
>
> Essentially yes.
>
>> If so, I don't see the benefit of the change; usually we'd
>> rather save CPU time even if a bit more memory is used.
>
> It also simplifies the code because it removes one of the cases that
> depends on trans_width.

Sorry, I misread what you wrote.  This is a long-term allocation, and
the reading of the file happens only once per allocation, so I do think
that the additional __fread_unlocked call is not a problem from a
performance perspective.

Thanks,
Florian



More information about the Libc-alpha mailing list