On Mon, Mar 15, 2004 at 07:48:21PM -0500, Mike Jakubik wrote: > Max Laier said: > > > Sure, you measure it ;) ... no, of course it is more expensive to update a > > 64bit counter on a 32bit arch, but the key (once again) is descision: > > While > > (almost) all of the pf counters are 64bit types you can configure it not > > to > > use the loginterface or whatsoever more. So it's up to you: You need 64bit > > counters? You shall have them! You need *fast* 64bit counters? AMD sells > > nice processors (they say)! ... you get the idea. > > Got it. In just curious though... realistically, how big of an impact on > performance is this on a modern CPU? Is it not simply the original 32bit > calculation x 2?
No, you have to do overflow handling so that adds some to the cost. I was curious what the actual overhead was so I ran the following program with both uint32_t and uint64_t counters. With 64-bit counters, it was a bit over four times slower on a the dual 2.2GHz Xeon (~2sec vs ~8.4sec). On a dual opteron, the 32-bit math had a slight edge, but not much. Intestingly, runtime was longer then on the Xeon (~3.1s for 32-bit and ~3.8 for 64-bit.) If you do this test, be sure not to use any optimizer flags or the whole loop gets optimized out. -- Brooks #include <stdio.h> #include <stdint.h> int main (int argc, char **argv) { uint32_t j = 0; for (j = 0; j < 1000000000; j++) {} printf("%d\n", j); } -- Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
pgp00000.pgp
Description: PGP signature