Re: [RFC, 2.6] a simple FIFO implementation

From: Anton Blanchard
Date: Fri Sep 17 2004 - 07:03:18 EST



> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/