SWI-Prolog Did You Know Did you know? the Profiler can speed up your code Search Documentation:
Predicate empty_interval/2