improve cache matrix