[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070205101637.GB1863@ff.dom.local>
Date: Mon, 5 Feb 2007 11:16:38 +0100
From: Jarek Poplawski <jarkao2@...pl>
To: Andi Kleen <ak@...e.de>
Cc: Simon Lodal <simonl@...knet.dk>, Patrick McHardy <kaber@...sh.net>,
netdev@...r.kernel.org, lartc@...lman.ds9a.nl
Subject: Re: [PATCH] HTB O(1) class lookup
On 01-02-2007 12:30, Andi Kleen wrote:
> Simon Lodal <simonl@...knet.dk> writes:
>> Memory is generally not an issue, but CPU is, and you can not beat the CPU
>> efficiency of plain array lookup (always faster, and constant time).
Probably for some old (or embedded) lean boxes used for
small network routers, with memory hungry iptables -
memory could be an issue.
> Actually that's not true when the array doesn't fit in cache.
>
> The cost of going out to memory over caches is so large (factor 100 and more)
> that often algorithms with smaller cache footprint can easily beat
> algorithms that execute much less instructions if it has less cache misses.
> That is because not all instructions have the same cost; anything
> in core is very fast but going out to memory is very slow.
>
> That said I think I agree with your analysis that a two level
> array is probably the right data structure for this and likely
> not less cache efficient than the hash table.
Strange - it seems you gave only arguments against this
analysis...
> And the worst memory consumption case considered by Patrick should
> be relatively unlikely.
Anyway, such approach, that most users do something
this (reasonable) way, doesn't look like good
programming practice.
I wonder, why not try, at least for a while, to do this
a compile (menuconfig) option with a comment:
recommended for a large number of classes. After hash
optimization and some testing, final decisions could be
made.
Regards,
Jarek P.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists