I just watched a video that Shay Akai did on this topic exactly. The points he made, confirmed my understanding of the concepts.
Comp/muzzle break= for counteracting recoil (an extremely efficient comp would prevent the slide from even unlocking)
Holes= for counteracting muzzle flip. This comes at the expense of gas to work the comp, so typically harsher feel in the hand. Barrel length plays a factor in this due to the length of the lever acting. Taking it to the extreme would actually push the muzzle down when you fire a shot.