As described in section 1.1.3, collecting answers is the critical problem in logic programming. In a sense, it is the weakest point in logic programming languages because it can be bottle neck for efficiency. We can spawn arbitrary number of processes among processors, however, when the answer are collected, only one data stream has to be used. Namely, plural messages have to be merged somewhere.
Merger is a process which receives messages to merge them into one message stream (fig. 1.8). We should note that the order of each message is not unpredictable. Function of merger is distinct from one of predicate join_lists in module list although they are similar at a glance. In merger, the orders of messages among streams are not preserved (fig. 1.8).
KL1/KLIC documents [Sekita, 1998] did not mention how to merge messages from recursively called goals (processes). In DeepForest merger has tree structure as shown in 1.9. Efficiency between mergers having tree structure and flat list structure was compared. The results are shown in table 1.4. Tree structure mergers contributed to improve efficiency.
Method | No. of rep | No. of CPU | Time (msec) |
append | 10 | 10 | 673856 |
merge | 10 | 10 | 533177 |
append | 20 | 10 | 781917 |
merge | 20 | 10 | 776671 |
append | 100 | 30 | 1770854 |
merge | 100 | 30 | - |