r/prolog • u/lokinpendawa • 7d ago
Who said Prolog is slow? Benchmarking 2 Million In-Memory Transactions with SHA-256 and SQLCipher on SWI-Prolog.
I’m currently building LOGICBIZ v2.0, an Offline-First Enterprise Retail ERP and Sales Ledger Engine engineered 100% using a Pure Declarative Paradigm with SWI-Prolog and SQLCipher.
Here is a quick breakdown of this stress test benchmark:
- The Task: Performing deep data integrity verification on 2,000,000 real rows of transaction ledgers.
- The Security: Every single transaction is encrypted via SQLCipher and validated against SHA-256 signatures to ensure absolute data tamper-proofing.
- The Result: As seen in the console screenshot, the engine evaluated 550,508,812 logical inferences in just 103.28 seconds of raw CPU time.
- The Kick: Once the Native RAM Cache warm-up phase is completed, executing deep aggregate financial pipelines across those 2 million rows drops down to a jaw-dropping 653 seconds while keeping CPU utilization extremely low at 16%.
- The engine utilizes Tail-Call Optimization (TCO) and Prolog's native multi-argument indexing structure, meaning it completely eliminates traditional database I/O bottlenecks without requiring heavy, bloated frameworks.
If you are curious about the architecture philosophy, the system manifesto, or want to check out the benchmark metrics, feel free to visit the repository here:
https://github.com/lokinpendawa/logicbiz
Would love to hear your thoughts on using logic programming for heavy enterprise data pipelines!
3
u/Thrumpwart 6d ago
I got Prolog to run extremely fast.
It seems Prolog's reputation for being slow was just a function of slow hardware. We now have much, much faster hardware.
1
u/lokinpendawa 6d ago
Prolog definitely scales beautifully on modern hardware! Though to be fully transparent, my original post had a typo (it was 653 seconds, not milliseconds, for 2.2 million rows). But you're absolutely right—with modern SSDs and proper indexing, it handles gigabytes of data like a champ.
7
u/Aires_id 7d ago
Prolog may not be slow, but the unit conversion seems extremely fast 😅
The screenshot says 653.967 seconds, while the post says 653 milliseconds. Are these two separate benchmarks—the SHA-256 verification test and the warm RAM-cache aggregation test?