Improve max-height performance