support should_optimize option