Improve similarity computation speed.