Hi everyone,
I want to start by saying that I am a complete beginner in programming. I have zero background in computer science, and I only started learning coding from scratch about two months ago. My friends originally recommended Python and JavaScript, but I found myself bored within two weeks.
However, since my youth, I have always had a deep passion for first-order predicate logic. That hobby led me to stumble upon Prolog. While many people around me laughed and said it was an outdated language that wouldn’t lead anywhere, I fell in love with it. I haven’t been bored for a single day.
As a beginner, most of my journey has been copying and pasting code snippets from the internet, adjusting predicates to fit my business logic, matching arities, and asking AI tools to fix my mistakes. Yet, by choosing SWI-Prolog, my little project—LOGICBIZ v2.0—has achieved something that even experienced developers in other languages struggle to build in months. I am incredibly proud of what this language can do!
I wanted to share an empirical benchmark result from an endurance and stress test of my retail point-of-sale core engine, LOGICBIZ v2.0, written entirely in SWI-Prolog.
As a hobbyist of first-order predicate logic who started learning Prolog from scratch just 2 months ago, I wanted to rigorously push the engine to its physical hardware limits before distributing it commercially.
1. Test Setup & Hardware Boundary
The soak test was executed on a constrained consumer laptop to observe lightweight efficiency:
- CPU: AMD Processor @ 3.36 GHz (Integrated Radeon Graphics)
- RAM: 8.0 GB DIMM Dual-Channel @ 1200 MHz
- Storage: Local SSD (Enforced active SQLCipher AES-256 database encryption at rest)
- Pipeline Payload: 200 concurrent virtual cashiers executing authentic frontend transactions via
proses_transaksi/8simultaneously (Total: 200,000 unique invoices). Every single receipt undergoes real-time SHA-256 cryptographic hashing.
2. Empirical Statistics (Captured from SWI-Prolog Kernel)
The automated test concluded with ZERO DEADLOCKS and 0% crash rate. Here are the final statistics:
- Total Execution Time: 24,822.20 seconds (~6.9 Hours continuous run).
- Logical Operations: 140,056,185,193 inferences evaluated (~4.71 Million LIPS).
- Throughput Speed: Averaged at 8.06 TPS (highly restricted by SQLCipher’s single-writer mutex file-locking boundary).
- Garbage Collection: 61,582 atom garbage collections executed, sweeping 1.83 Billion transient atoms.
- Post-Execution Active Stack Memory: Miracle-collapsed back to just 334 KB (Kilobytes)!
3. Architectural Design Highlights
To prevent stack overflows under this massive transactional load, I completely decoupled the system into clean modules: retail_brain.pl (holding 4000 lines of pure logical rules) and retail_server.pl. Furthermore, I extracted core primitive rules from Inductive Logic Programming (Metagol), froze the derived rules into a static intelligence_rule_temp.pl, and compiled it directly via qcompile/1 to ensure zero runtime overhead.
3.1 Architectural Decomposition via Prolog XREF
Below is the dependency graph generated via the Prolog Cross-Referencer (XREF). As visualized, retail_brain.pl serves as the completely isolated logic engine, processing core rules independently from I/O bound modules such as retail_print.pl and frontend channels like retail_pos.pl. This strict modular encapsulation (Separation of Concerns) is the precise architectural reason why the active memory footprint effortlessly collapsed back to 334 KB upon pipeline resolution.
(Attached: Screenshot of the Prolog XREF Dependency Graph)
4. Next Steps & Commercial Plan
I am currently translating all remaining internal predicates and documentation into full English. In the coming months, I plan to deploy and distribute the standalone binary (standalone .exe and compiled .qlf blocks) via Gumroad for developers looking for an absolute bulletproof, memory-leak-free POS logic engine.
I would love to hear your thoughts, feedback, or any optimization tips on mitigating the SQLCipher file-locking latency!
(Attached: Screenshot of the final statistics. output console)











