[web-devel] new fast-logger and date-cache
greg at gregorycollins.net
Wed Sep 5 12:32:21 CEST 2012
On recent (>2009) Linux, you can call clock_gettime() with
CLOCK_REALTIME_COARSE which is about 6x faster:
On my workstation calling clock_gettime(CLOCK_REALTIME, ...) and poking the
value into a Haskell struct takes about 70ns, with CLOCK_REALTIME_COARSE
it's about 19ns (with a much lower stddev). Worth using for this
application if it's available. Of course, in Snap we do the "update the
clock every second in a thread" trick also.
On Wed, Sep 5, 2012 at 4:10 AM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
> >> To my experience, the assumption 2) is not right. getttimeofday()
> >> is implemented in user land in Linux 3 but it is a system call
> >> in Linux 2.
> > Just a nit: your history here is not correct. gettimeofday has been
> > implemented as a vsyscall for a long time, maybe 5 years. And while it's
> > faster than int 0x80, it's not that much faster: 2x or so on modern
> Thank you for your correction.
> To whose who are interested in, additional information can be found
> Anyway, I believe we should avoid gettimeofday as much as possible
> to implement fast servers.
> web-devel mailing list
> web-devel at haskell.org
Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the web-devel