Atlassian Interview Question

How would you optimize this operational function?