cache the scores matrix to improve performance