Re: [RTnet-developers] Maintaining UDP sockets in a hash instead of a list.
Brought to you by:
bet-frogger,
kiszka
|
From: Gilles C. <gil...@xe...> - 2008-06-30 10:01:48
|
Wolfgang Grandegger wrote:
> Hi Gilles,
>
> Gilles Chanteperdrix wrote:
>> Hi,
>>
>> here is another patch to RTnet, which replaces the list of UDP sockets
>> with a hash, so makes the searching for an RTnet registered socket a bit
>> faster.
>
> What does a "bit faster" mean. I'm curious, do you have some benchmark
> figures at hand?
No, but the current scheme is to test every packet against every socket
(until one is found). This is O(N).
With a hash, and a well dimensioned/behaved system, you get O(1).
So, no doubt there is a gain, at least on systems with many sockets
opened, and especially when you receive many non real-time UDP packets
which you must send to the proxy: non real-time packets are tested
against all opened sockets, to finally find that they are matching none
of them.
--
Gilles.
|