Many robotic systems locomote using gaits - periodic changes of internal shape, whose mechanical interaction with the robot`s environment generate characteristic net displacements. Prominent examples with two shape variables are the low Reynolds number 3-link "Purcell swimmer" with inputs of 2 joint angles and the "ideal fluid" swimmer. Gait analysis of these systems allows for intelligent decisions to be made about the swimmer`s locomotive properties, increasing the potential for robotic autonomy. In this work, we present comparative analysis of gait optimization using two different methods. The first method is variational approach of "Pontryagin`s maximum principle" (PMP) from optimal control theory. We apply PMP for several variants of 3-link swimmers, with and without incorporation of bounds on joint angles. The second method is differential-geometric analysis of the gaits based on curvature (total Lie bracket) of the local connection for 3-link swimmers. Using optimized body-motion coordinates, contour plots of the curvature in shape space gives visualization that enables identifying distance-optimal gaits as zero level sets. Combining and comparing results of the two methods enables better understanding of changes in existence, shape and topology of distance-optimal gait trajectories, depending on the swimmers' parameters.