[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scheme prolog compiled to c

From: Stefan Israelsson Tampe
Subject: scheme prolog compiled to c
Date: Sat, 16 Jul 2011 23:11:40 +0200


*** fun fun fun and a lot of sunĀ  ***

I know have a macro package that can output guile-log to c-code directly. The key ingredients to make this work
is to have tail call macros via trampolines and closures. With this one can device a macro framework
that outputs directly to C. The code look pretty much like the scheme code the prolog stuff is in 170 lines
ontop of clambda. Using this 50 lines defining trhe queens example get compiled into about 3000 lines of

The findings shows for N=10 that code that takes 0.45s in the scheme version takes about 0.3s in the compiled to C
version. Note here that this includes gc. without gc the algorithm takes about 0.22s.

If I recall correctly compiled gprolog takes around 0.1s for the same algorithm.

The scheme version in guile-unify is a mix of using promps and continuation closures and hence there is less pressure
on the gc for the code above that places everything in tail call position. So it looks like the scheme version is an ok trade
off between stack usage and heap usage.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]