[Haskell-cafe] Faster timeout but is it correct?
Bas van Dijk
v.dijk.bas at gmail.com
Fri Feb 18 10:14:05 CET 2011
On 18 February 2011 01:05, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Thu, Feb 17, 2011 at 5:01 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>> willTimeout/old 24.34945 us 1.0 x
>> willTimeout/new 26.91964 us 0.9 x (large std dev: 5 us)
>> willTimeout/event 12.94273 us 1.9 x :-)
>>
>> wontTimeout/old 16.25766 us 1.0 x
>> wontTimeout/new 637.8685 ns 25.5 x :-)
>> wontTimeout/event 1.565311 us 10.4 x :-)
>
> I find this very surprising. Both new and event eventually ends up
> using the event manager in the end. One via threadDelay (which calls
> registerTimeout) and one directly via registerTimeout. The difference
> should be that "new" also spawns a thread.
I guess the new timeout exploits parallelism because it forks a thread
do to the work with the event manager. I think that this thread is
then killed before it even begins dealing (through threadDelay) with
the event manager.
Bas
More information about the Libraries
mailing list