[Eventmachine-talk] Ruby I/O

Thomas Ptacek
Tue, 13 Mar 2007 16:19:46 -0000

A SWAG, created exclusively in the service of not cluttering the list
with another 500 word message without writing a line of code:

http://pastie.caboo.se/46697

tsc_gettimeofday() from this link is thus a drop-in replacement for
g.t.o.d(). I haven''t profiled; I recalibrate every 20 calls
(calibrating the TSC is a pain). I make no claims to performance,
portability, or correctness.

On 3/13/07, Francis Cianfrocca <garbagecat10 at gmail.com>
wrote:
> On 3/13/07, Thomas Ptacek <tqbf at matasano.com> wrote:
> >
> > The gettimeofday stuff is a problem. Every high-speed project
I''ve
> > worked on has replaced gettimeofday; it''s a drag on
performance. I''m
> > pretty sure the "correct" answer now is to calibrate and use
rdtsc,
> > the cycle counter, which is essentially free (costs about as much as a
> > non-cached DRAM access). If you calibrate, you can convert from TSC
> > cycles to a struct timeval to hand select().
>
>
> You''re cordially invited to send me a patch ;-)
>
>
> _______________________________________________
> Eventmachine-talk mailing list
> Eventmachine-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/eventmachine-talk
>