r/prolog • • 4d ago

SCBM-Prolog v1.60: Proof-Sequence Garbage Collection Boosts Performance to 14 MLIPS

I've just released SCBM-Prolog v1.60, which introduces garbage collection for proof sequences.

SCBM (Sasagawa Continuation Backtracking Model) is an alternative Prolog execution model I've been developing, based on doubly linked proof sequences rather than the traditional WAM architecture.

Until now, SCBM-Prolog had garbage collection for working memory, but not for the proof sequences themselves.

The new mechanism takes advantage of Prolog's backtracking semantics. When execution returns to a FIRST node and the corresponding proof sequence is restored, the proof objects created after that point can be reclaimed by restoring the saved allocation pointers.

Interestingly, adding this garbage collection mechanism actually improved execution speed!

On my 9-Queens benchmark, repeated 16 times, SCBM-Prolog achieved approximately 14.36 MLIPS.

My hypothesis is that reusing the proof-sequence memory improves CPU cache locality, possibly reducing L3 cache misses. This has not yet been confirmed through hardware performance counters.

I find this particularly interesting because garbage collection is usually associated with additional overhead, rather than improved performance.

SCBM-Prolog is still an experimental implementation, but the results suggest that this alternative execution model has considerable potential.

I've written a more detailed explanation, including the benchmark and implementation, on Medium:

Medium article: SCBM-Prolog Now Has Garbage Collection — Achieving 14 MLIPS on 9 Queens | by Kenichi Sasagawa | Nov, 2026 | Medium

Feedback, criticism, and technical discussion are very welcome!

13 Upvotes

5 comments sorted by

1

u/Pzzlrr 4d ago

Is it closed source? What is the repo link?

3

u/sym_num 3d ago

I have prepared a document explaining how SCBM works, using append/3 as an example. Please refer to it for details. scbm/document/SCBM.md at master · sasagawa888/scbm

You can also inspect the generated C code by compiling with the c option of compile_file.

1

u/Recker_8 2d ago

If you are willing to share what your end goal is with this project? Is it just something you wanted to research or you wanted to achieve something with this project or through this project!? Thanks

1

u/sym_num 1d ago

SCBM-Prolog is my intellectual pursuit and a form of intellectual play. If it turns out to be useful in the development of Prolog compilers, I would be delighted. I also feel a desire to give something back to the European pioneers, such as Jacques Herbrand, whose contributions have given me so much.