Re: [PATCH 3/6] IPV4 : use xor rather than multiple ands for route compare

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Miller
Date: Thursday, April 10, 2008 - 3:56 am

From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date: Thu, 10 Apr 2008 18:01:48 +0900 (JST)


Actually the case you mention it is part of the incentive for
this change.

Branch prediction fares very poorly in such cases, and
therefore it is better to mispredict one branch over
all the data items in the same cache line than any one
of several such branches.  The above new sequence gets
emitted by the compiler as several integer operations and
one branch.  As long as all the data items are in the
same cacheline, this is optimal.

We made such a change for ethernet address comparisons a
few years ago.  At the time Eric showed that it mattered
a lot for Athlon processors.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/6] IPV4 : use xor rather than multiple ands for r ..., Stephen Hemminger, (Mon Mar 31, 5:47 pm)
Re: [PATCH 3/6] IPV4 : use xor rather than multiple ands f ..., YOSHIFUJI Hideaki / , (Thu Apr 10, 2:01 am)
Re: [PATCH 3/6] IPV4 : use xor rather than multiple ands f ..., David Miller, (Thu Apr 10, 3:56 am)
Re: [PATCH 3/6] IPV4 : use xor rather than multiple ands f ..., YOSHIFUJI Hideaki / , (Thu Apr 10, 5:17 am)