Issue title: eval_all_combinations better method
 Issue body: Hi ,
I am doing my `eval_all_combinations` in the O(n^3) which is slowing my execution is there any better way of doing it ?

 Comments: 
 Comment 0: A trick lies in how you arrange the loops to get it efficient. Try that out. 
{'source': 'GithubIssues', 'repo_name_with_owner': 'iit-cs579/main', 'issue_id': 184017517, 'repo_stars': 145.0}