Re: [eclipse-clp-users] Hunting for bottlenecks: Is factbase stored on-disk?

From: Kish Shen <kisshen_at_...5...>
Date: Thu, 13 Sep 2012 00:37:05 +0100
A clarification on my last post on the indexing for static code:

The indexing is done for one argument, but indexing code for all 
arguments where indexing is useful will be generated,
so if you have something like

f(1, a).
f(2, a).
f(1, c).


and you call the goal f(1, X), indexing will be done on the first 
argument, so f(2,a) would be filtered out and not tried.
If you call the goal f(X, c), indexing will be done on the second 
argument, so f(1, c) will be the only clause that will be tried.
In outline, the indexing code looks like

if argument1 is an integer, index on argument1

if argument2 is an integer, index on argument2

If you call f/2 with both arguments instantiated, e.g.
f(2,a), the indexing is still done with one argument. If the indexing is 
on the first argument, f(2,a) will be the only clause tried, but if the 
indexing is on the second argument, then f(1,a) and f(2,a) will be 
tried. What the compiler decides by heuristic is if the indexing is done 
on the first or second argument when both arguments in the goal is 
instantiated, i.e. to decide between

if argument1 is an integer, index on argument1
else if argument2 is an integer, index on argument2

if argument2 is an integer, index on argument2
else if argument1 is an integer, index on argument1


Cheers,

Kish
Received on Wed Sep 12 2012 - 23:37:15 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST