Thread (13 messages) 13 messages, 7 authors, 2006-08-14

Re: [PATCH 1/6] ehea: interface to network stack

flat view

From: Jörn Engel <hidden>
Date: 2006-08-14 11:27:09
Also in: lkml, netdev

On Sat, 12 August 2006 06:56:24 +1000, Anton Blanchard wrote:
quoted
+
+				skb_index = ((index - i
+					      + port_res->skb_arr_sq_len)
+					     % port_res->skb_arr_sq_len);
This is going to force an expensive divide. Its much better to change
this to the simpler and quicker:

i++;
if (i > max)
	i = 0;
Is a conditional cheaper than a divide?  In case of a misprediction I
would assume it to be significantly slower and I don't know the ratio
of mispredictions for this branch.

Jörn

-- 
Victory in war is not repetitious.
-- Sun Tzu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help