In automated industrial production, the effciency of robotic motions directly affects both the final throughput and the energy consumption. By simulating and optimizing robot trajectories, cycle times and energy consumption can be lowered, or redundant robots can be detected. Here a polynomial basis function trajectory parametrization is presented, which enables direct export to executable robot code, and reduces the number of variables in the optimization problem. The algorithm finds time-optimal trajectories, while including collision avoidance and fulfilling joint, velocity and acceleration limitations. Applied torques are used as an approximation of the energy consumption to analyse the smooth trajectories, and successful tests show potential reductions of 10% for a standard industrial robot stud welding station.