An experiment-based approach is proposed to improve the performance of biomimetic undulatory locomotion through on-line optimization. The approach is implemented through two steps: (1) the generation of coordinated swimming gaits by artificial Central Pattern Generators (CPGs); (2) an on-line searching of optimal parameter sets for the CPG model using Genetic Algorithm (GA). The effectiveness of the approach is demonstrated in the optimization of swimming speed and energy efficiency for a biomimetic fin propulsor. To evaluate how well the input energy is converted into the kinetic energy of the propulsor, an energy-efficiency index is presented and utilized as a feedback to regulate the on-line searching with a closed-loop swimming control. Experiments were conducted on propulsor prototypes with different fin segments and the optimal swimming patterns were found separately. Comparisons of results show that the optimal curvature of undulatory propulsor, which might have different shapes depending on the actual prototype design and control scheme. It is also found that the propulsor with six fin segments, is preferable because of higher speed and lower energy efficiency.