Question is: what is the fastest and portable way to reverse bits in byte in C?
I have read article on corner.squareup.com and choose two faster portable functions.
I made additional comparing of function performance.
Comparing environment: ideone.com. Compiler: gcc-4.7.2.
Below is code:
Here is results of performance testing:
200000000 calls of ReverseBitsSimpleAndElegant takes 1.660000 seconds.
200000000 calls of ReverseBitsLookupTable takes 0.980000 seconds.
200000000 calls of ReverseBits7ops32bit takes 0.920000 seconds.
So, function ReverseBits7ops32bit is the fastest way which i has found.
Let me know if you find faster way. I will check.
No comments:
Post a Comment