Optimize the following Python code for calculating the sum of an array.
arr = [1, 2, 3, 4, 5, 6]
total = 0
for el in arr:
 total += el
arr = [1, 2, 3, 4, 5, 6]
total = sum(arr) # use sum() to sum up all elements of the array in one line