How would you optimize a matrix multiplication operation in Python using NumPy, and what are the underlying memory implications?