Michael W. Ryder
4/27/2007 8:08:00 AM
John Joyce wrote:
>
> On Apr 27, 2007, at 9:58 AM, Lionel Bouton wrote:
>
>> Joel VanderWerf wrote the following on 27.04.2007 00:04 :
>>> khaines@enigo.com wrote:
>>> ...
>>>> Try select()
>>>> ----
>>>> irb(main):005:0> 0.upto(25) do
>>>> irb(main):006:1* select(nil,nil,nil,0.01)
>>>> irb(main):007:1> puts Time.now.usec/1000
>>>> irb(main):008:1> end
>>>> 138
>>>> 148
>>>> 158
>>>> 168
>>>> 178
>>>> 188
>>>> 198
>>> ...
>>>
>>> What kind of system are you on? It doesn't work so well for me.
>>
>> I'm wondering too, I see a nearly constant 2ms delay added to the 10ms
>> sleep with select on both an Athlon64 X2 3800+ and an Athlon XP 2400+.
>>
>> Is there some YARV in there?
>>
>> Lionel
>>
> Have you all tried this outside of irb?
> Just run the actual script itself + profiler to find out where the
> slowdown is occurring.
> Try it with sleep and select versions. This might show some different
> points.. maybe not.
>
I tried your script on Windows under irb and using ruby and get similar
results. I end up with times like 171.0, 171.0, 187.0, 203.0,
203.0,..., obviously select is not waiting, at least under Windows.