Add support for optimizing multiple traces at the same time.