time the calculate similarity function