Hi,

I'm the author of a DSL that allows reasoning over paths throughout graphs 
using core.logic ( https://github.com/ReinoutStevens/damp.qwal ). We 
noticed that for larger graphs performance became horribly slow, even 
though there is no apparent reason why it should be. First investigations 
lead me to believe tabling was the issue. We use tabling to prevent 
infinite loops due to cycles in the graph. After writing a small testcase 
that exhibits the described problems I've noticed that it is a combination 
of tabling and looping over a list.

In the test case we construct a linear graph (so: a graph where each node 
has a single successor). We want to asser that there exists a path from the 
start to the end node. This is done by using the logical rule trans [graph 
current next], which given a graph and the current node binds next to the 
possible successors. We write this query in three different ways. First, we 
try to succeed the goal trans as many times as needed, until we end up in 
the end state. Next, we do the same but tabling our loop. This prevents 
looping in case our graph would contain a cycle (in this case, there is no 
such cycle). Finally, instead of directly proving trans, we prove a list of 
goals. This list contains a single goal (trans). This last scenario runs 
much slower than the previous two, even though I don't see a large 
difference with the first two scenarios.

In attachment the code of our test case. There are 3 functions at the end, 
each implementing one of the described scenarios. Note the difference 
between solve-goal and solve-goals.

Any pointers how to solve the issue, or work around it are appreciated.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Attachment: tabling.clj
Description: Binary data

Reply via email to