Popcount as an Example Of Microbenchmarking in C. Talk by Bart Massey at pdxbyte March 11, 2014.
Quickly determining the number of 1 bits in a binary machine word, the so-called "popcount", has always been an interesting problem for developers. Popcount is useful in applications ranging from cryptography to games, so it is worth trying to optimize. In this talk, I will report on a number of different popcount algorithms and their C implementation performance, in the context of a "microbenchmarking" framework custom-built in C for this purpose. I will also explore the pitfalls of C in microbenchmarking and the issues, problems and relevance of microbenchmarking in general.
Speaker Bio: Bart Massey got his B.A. in Physics from Reed in 1987, having learned C while he was there. After a couple of years writing C code at Tektronix, Inc. Bart attended University of Oregon, where he received his MSCS in 1992 and his Ph.D. in 1999. For the past 14 years, he has been a Computer Science Professor at Portland State University. He still writes more C than he cares to admit.
https://github.com/BartMassey/popcount
pdxbyte is a Portland, Oregon users group primarily for languages that compile to machine native format such as C, C++, and Assembly. http://pdxbyte.org