* Massimiliano Mirra (list / chromatic-harp.com) wrote:

> ...Three puts and gets with one-time connections: 0.036726 secs
> ....Three puts and gets with a persistent connection: 0.162311 secs
> .
> Finished in 0.204511 seconds.
> 2 runs, 6 assertions, 0 failures, 0 errors
> 
> Four times as slow?!  Someone please tell me that there is some
> macroscopic mistake in the code below (or that this is a bad dream).

...Three puts and gets with one-time connections: 0.297782 secs
....Three puts and gets with a persistent connection: 0.596412 secs
.
Finished in 0.897749 seconds.
2 runs, 6 assertions, 0 failures, 0 errors
ruby svr.rb  0.15s user 0.02s system 16% cpu 1.017 total

Looks like it's waiting most of the time.  I'd suggest setting
TCP_NOWAIT on the socket, otherwise it's probably hanging around at the
end of each operation for something else to fill the packets with before
sending.

<tries to remember how to use setsockopt()>

-- 
Thomas 'Freaky' Hurst  -  freaky / aagh.net  -  http://www.aagh.net/
-
I am NOMAD!