Please consider the attached patch for incorporation into the next Linux 2.6 release. I found that using the __builtin_memcmp GCC intrinsic for doing IPv6 address comparison a lot more slow than integer comparison. In significant SCTP workloads I found address comparison taking roughly 10% of the CPU time. After changing the address comparison to an integer-based approach the comparison consumed 5% of the CPU time. I also microbenchmarked the comparison on my architecture, a Pentium 4, and found the integer comparison was over 3x faster than the string comparison. The microbenchmark consisted of a series of address comparisons where 20% matched and 80% that didn't match. I looked at addresses that differed in the first, last, and random byte. The benchmark code and detailed results are freely available. Please just e-mail me a request. There is not a convenient web forum to make them available, and I prefer not deluge your mailboxes. Thanks, Dave Craig Signed-off-by: Dave Craig <dwc at nospamqualcomm dot com> *WARRANTY DISCLAIMER: LIMITATION OF LIABILITY. THE SOFTWARE AND CONTENT ARE PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED REPRESENTATIONS, GUARANTEES, OR WARRANTIES, INCLUDING BUT NOT LIMITED TO SUCH REPRESENTATION, GUARANTEES OR WARRANTIES REGARDING THE USABILITY, SUITABILITY, CONDITION, OPERATION OR ACCURACY THEREOF. * *ALL OTHER WARRANTIES AND CONDITIONS (EXPRESS, IMPLIED OR STATUTORY) ARE HEREBY DISCLAIMED, SUCH WARRANTIES AND CONDITIONS INCLUDING WITHOUT LIMITATION, ALL WARRANTIES AND CONDITIONS OF MERCHANTABILITY, TITLE, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, COMPATIBILITY, AND SECURITY OR ACCURACY.*
Attachment:
addr_cmp.patch
Description: addr_cmp.patch