input: Write a function to optimize the given Python code for better efficiency. If the given list `data` has elements greater than 2, append them to `result`. Return the optimized result list. If `data` is empty, return an empty list.
  assert optimize_list([1, 2, 3, 4])==[3, 4]
  assert optimize_list([1, 2])==[]
  assert optimize_list([3, 4, 5])==[3, 4, 5]
  assert optimize_list([4, 2, 3])==[4, 3]
  assert optimize_list([])==[]
output: def optimize_list(data):
      return [x for x in data if x > 2]