Hi Stefan, Stefan Israelsson Tampe <stefan.ita...@gmail.com> skribis:
> On Wed, Apr 4, 2012 at 11:52 PM, Ludovic Courtès <l...@gnu.org> wrote: > >> Hi Stefan, >> >> Stefan Israelsson Tampe <stefan.ita...@gmail.com> skribis: >> >> > If you want independence use kanren. For guile this approach is 10x >> faster >> > then kanren >> > and 10x slower that a compiled prolog. Previously I thought that kanren >> has >> > a more functional >> > fundament and can express amazing things. But i'm now inclined that >> > guile-log has a feature >> > that are very cool and I will try to explain this feature for the fun of >> it. >> >> Any idea why there’s such a performance difference? >> > > Yes the lookup cost can be substancially higher (in guile-log that's just a > one or two dereferenses) but on kanren you need to search an alist of all > bindings, That’s no excuse: Kanren could use a vhash or similar, as you noted. ;-) > the number of lambdas is more for each operations and, maybe not that > important but the allocations in guile-log is from a stack, but kanren > uses a heap. the unify function in guile-log is in C while the same > function is kanren is in scheme. And lastly guile-log is a heavy > macrology in order to support cut's but kanren uses no cut and can > stay functional, but this means that kanren features more lambda > constructions and i'm uncertain if peval can counteract this. Hmm, OK. [...] > Well if you want to translate prolog programs to scheme guile-log is > actually a better fit But I’m not sure whether getting Prolog programs translated is a worthy cause. :-) Thanks, Ludo’.