max() caching