optimize-transition-function needs argument to indicate whether the transitions are disjoint
If we have to check whether the transitions are disjoint then the function is slower. If the calling function has generated disjoint transitions by construction, then optimize-transition-function can be much faster.