input: Write a python function to sort a list of numbers using a heap.
  assert optimized_sort([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == [1, 1, 2, 3, 3, 4, 5, 5, 5, 6, 9]
  assert optimized_sort([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  assert optimized_sort([5, 10, 15, 20, 25, 30]) == [5, 10, 15, 20, 25, 30]
output: def optimized_sort(arr):
      import heapq
      heapq.heapify(arr)
      return [heapq.heappop(arr) for _ in range(len(arr))]