As a PlayStation3 SPU programmer, I am a big fan of "__builtin_expect()". It is a C/C++ compiler built-in intrinsic that can improve branch prediction. If you are not familiar with the intrinsics, have a look on GCC document here.
According to "RealView" document here, ARM seems to have a way to take advantage of the intrinsic but GCC doesn't seem to generate any special code about it.
The screenshot above shows my C++ code for testing the performance difference.
The screensoht above is testing result. I compiled it with an optimization option, "-O3". It shows 8 run times and it doesn't show conclusive difference; the difference is under 0.2%.
I tried a little different approach to make sure it doesn't make difference. I generated assembly code and compared them. There was no difference between expecting false and expecting true.
I am not sure if there is any hidden magic compiler version or compiler option to utilize __builtin_expect on RaspberryPi but I should conclude that the intrinsic doesn't work on RaspberryPi with GCC.
Hello Jay,
ReplyDeleteThe Article on Performance testing with C++ intrinsic give detailed information about it. Thanks for Sharing the information about the Performance testing with C++ intrinsic. For More information check the detail on the Performance Testing here,Software Testing Company
Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Visit here for Penetration testing services and Software testing services
ReplyDelete