Consider the following Python function,
import numpy as np
def getSCCS_slow(x, y):
"""
Return `sin(x) * cos(y) + cos(x) * sin(y)`.
"""
return np.sin(x) * np.cos(y) + np.cos(x) * np.sin(y)
What can you do to the above code to make it more performant?
Prove your suggestion by benchmarking your revised code against the original code above.
How much performance improvement do you observe?
(Hint: Think of rewriting the above trigonometric expression in terms of a single sin()
term.)