On 10 March 2013 22:55, Tibor Bamhor <tiborb95@xxxxxxxxx> wrote: > Hi, > > Thank for you interest. Today I spent some time reading about perf - it is > quite complex tool or rather it measures things that I am not familiar with. > However I did some primitive testing and got this output: > > ____7729.437618_task-clock________________#____0.386_CPUs_utilized__________ > ___________8556_context-switches__________#____0.001_M/sec__________________ > ______________0_cpu-migrations____________#____0.000_K/sec__________________ > ____________899_page-faults_______________#____0.116_K/sec__________________ > ____20346686795_cycles____________________#____2.632_GHz_____________________[92.65%] > ______________0_stalled-cycles-frontend___#____0.00%_frontend_cycles_idle____[99.92%] > ______588881284_stalled-cycles-backend____#____2.89%_backend__cycles_idle____[67.69%] > _____2234245557_instructions______________#____0.11__insns_per_cycle________ > __________________________________________#____0.26__stalled_cycles_per_insn_[71.21%] > ______931561726_branches__________________#__120.521_M/sec___________________[77.62%] > _____1877007958_branch-misses_____________#__201.49%_of_all_branches_________[84.88%] > > I dont dare to interpret it, but the "201.49%" in last line was in red so > there is obviously a problem there. Here I would start. > > If you (or anybody else) can point me at some source on internet I would be > thankfull. Or perhaps shortly explain how to mitigate the problem. But I > understand this is not gimp-specific issue... Yes, if you have branches in inner loops eliminating them can give large speedups. A quick google search gave this reference which looks like an OK start: http://software.intel.com/en-us/articles/avoiding-the-cost-of-branch-misprediction Less branching may also allow the compiler to auto-vectorize more. If you are unable to remove the branches in your inner loop, you can try to guide the branch predictor using GCCs __builtin_expect: http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html Note that not just if/case statements introduce branching, do/while/for do as well. -- Jon Nordby - www.jonnor.com _______________________________________________ gimp-developer-list mailing list gimp-developer-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gimp-developer-list