This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 05/10] Use clock_gettime to implement time.
- From: Florian Weimer <fweimer at redhat dot com>
- To: Zack Weinberg <zackw at panix dot com>
- Cc: libc-alpha at sourceware dot org, Joseph Myers <joseph at codesourcery dot com>, Lukasz Majewski <lukma at denx dot de>, Alistair Francis <alistair23 at gmail dot com>, Stepan Golosunov <stepan at golosunov dot pp dot ru>, Arnd Bergmann <arnd at arndb dot de>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- Date: Wed, 28 Aug 2019 20:16:31 +0200
- Subject: Re: [PATCH v2 05/10] Use clock_gettime to implement time.
- References: <20190828153236.18229-1-zackw@panix.com> <20190828153236.18229-6-zackw@panix.com>
* Zack Weinberg:
> Most ports were using gettimeofday to implement time, or they were
> making a direct (v)syscall. Unconditionally switch to using
> clock_gettime instead. All sysdeps implementations of time are
> removed.
I'm sorry, but this is clearly not advisable because clock_gettime is
almost an order of magnitude slower than time.
A synthetic benchmark with back-to-back time calls takes 2.3 ns on a
Xeon Gold 6126 CPU, but 17.9 ns on your branch.
Given that time has no stringent accuracy requirements, this shouldn't
come as a surprise.
Thanks,
Florian