prolog compiler optimization