This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [[PATCH RFC 2] 02/63] Y2038: add function __difftime64


On 05/03/2018 10:30 AM, Albert ARIBAUD wrote:
the simpler code in difftime.c which 64-bit signed integer
needs is enclosed in run-time conditionals, not compile-time
conditionals


These run-time conditionals are optimized away, and have zero run-time overhead.

Really, you should use difftime.c and see what it does (look at the machine code that is generated if you like). You will see that it does the right thing and generates the same instructions that your copy would. Similarly for many of the other routines that you incorrectly think we need to make source-code copies of.


I am choosing not to assume how clever compilers can be, and I consider
that putting a run-time test in some source code will be costlier in
execution time than not putting it there.

This is completely, 100%, backwards. It is routine in high-quality software nowadays to assume decent optimizing compilers; for example, that's why we now use functions rather than macros, since simple functions are routinely inlined. The glibc implementation assumes GCC, it is not our job to second-guess GCC, and we should not add complexity to glibc when GCC does a perfectly good job of optimizing simpler code.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]