This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] time: Avoid alignment gaps in __tzfile_read
Florian Weimer 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
The upstream code uses a single 'read' call, bypassing stdio entirely. It
doesn't even stat the file; all it does is 'access' (if a relative filename, for
security reasons), 'open', 'read', 'close'. I wonder why glibc went to stdio for
this? Seems overkill. In practice, I'd think going back to syscalls would gain
more performance than any of the stuff we've talked about so far.
Anyway - if we're moving things around, how about putting 'leaps' before
'transitions' instead of after? This will eliminate alignment gaps just as well
in practice, and it will allow us to do one fread instead of two.
PS. While you're in the neighborhood, the leap second correction field (struct
leap.change) can be 'int' instead of 'long int', as the TZif format allows only
32 bits of (signed) correction.