,---- | It would be interesting to know what the potential speedup is. It | should be easy enough to write a C program to measure that. But when | writing such a program, remember that no real program will simply | increment a concurrent counter. The question is not just how much | speedup you can get from a concurrent counter, but how much it will | matter to a real program. `---- normally, atomic-increment for uint64_t on x86 are very expensive. so a simple thing which works is to amortize that cost.
this basically translates to using a per-core uint16_t, and when that wraps around, just push the values via atomic update to a uint64_t, which is a global counter. when this scheme is compared with vanilla atomic-increment of uint64_t, it turns out to be quite fast (approx. 4-5 times better) where would you use this : well, if you are mantaining rx/tx stats for a 10g interface, it becomes significant :) i have tried this with vanilla C not go, so ymmv. -- kind regards anupam -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.