Messages in this thread | | | Date | Fri, 17 Sep 2004 21:58:42 +1000 | From | Anton Blanchard <> | Subject | Re: [RFC, 2.6] a simple FIFO implementation |
| |
> I did a similar test once for ppc that found that an increment followed by > a test (marked unlikely) was actually quicker in practice than modulo > arithmetic. The branch predictor got it right most of the time, so the > test was almost free.
Yep x % y where y isnt constant could result in a divide which will blow away 60+ cycles on some ppc machines. You can do a whole lot in those 60 cycles. Many memcpys for example :)
We removed all modulo arithmetic in the e1000 driver (replaced it with if (x > y) x = 0) and managed to measure an improvement.
Anton - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |