Optimize trajectory recorder