I agree with @GdD's answer in that the peaches need to be ripe for best flavor and easier pit removal. But let's not forget that there are two types of peaches - clingstone and freestone.
Splitting the peach is the preferred method for either. However, as the name implies, it is much easier to remove the pits from freestone peaches.
I personally prefer clingstone peaches as I find them to be more flavorful. That said, pit removal is difficult at best. Cling peaches are hardy enough that, even when ripe, they stand up to the pulling or twisting them apart. Overly ripe and they, like others, will turn to mush.
Additionally, clingstones tend to be slightly smaller than freestones. Depending on the use, that can mean more peaches to pit. Bonus with cling peaches is that they are typically ripe and available a little earlier in the season.
Also wanted to mention that peaches, like other fruits, should be rinsed under running water and dried before any cuts are made. And never peel the fruit before pitting. The skin helps to maintain the integrity of the fruit while handling.
+++ After looking around for a while, I found that there is a tool used for pitting stone fruit. It is a Stainless Steel Pitting Spoon. Here is a link to it on Amazon. And here is a link to a short video on YouTube showing how to use it.
Looks like it takes as much effort as pitting a cling peach, but the advantage is that the fruit remains whole.