max-key or min-key will evaluate (k value) multiple times for arguments if more than 2 arguments are passed. This is undesirable if k is expensive to calculate.
Good perf test:
Approach: Avoid repeated evaluation of k for any element.
A criterium test of the example above shows:
- Before: 206.017411 µs
- After: 126.532306 µs