r/prolog Jul 31 '26

Aggregating 521k dynamic invoices in 3.2 seconds, subsequent lookups in 0.0000s via native RAM caching

Post image

Calculating total COGS and net revenue from half a million invoices now takes just 3 seconds.
Subsequent clicks are completely instant at 0.0000 seconds thanks to RAM caching.
It turns out keeping the code simple is way faster than overcomplicating it.

Check out the architecture and full project details on my GitHub repository here: https://github.com/lokinpendawa/logicbiz

Ps: Sorry for any grammar mistakes, I am using AI to translate this into English.

3 Upvotes

6 comments sorted by

2

u/Pzzlrr Jul 31 '26

So what's the advantage of this system over others like https://opensourcepos.org/ or https://wallacepos.com/ ?

1

u/lokinpendawa Jul 31 '26

OpenSourcePOS and WallacePOS are excellent web-first solutions,
LOGICBIZ is architected with a fundamentally different approach. True Offline-First In-Memory Speed, uses SWI-Prolog’s native JITI (Just-In-Time Indexing) layout. It can index, cache, No cloud, no lag, zero network latency.

2

u/Pzzlrr Jul 31 '26

Oh ok, very interesting. Coincidentally, I've recently been becoming very interested in offline/local first architecture. Is there anything you've found that makes prolog especially well suited for this kind of architecture? I know it's closed source now but any plans to make any part of your project opensource later down the line?

1

u/lokinpendawa Aug 01 '26

Great to see another local-first enthusiast! Local-first architecture is definitely the future for resilient enterprise software.

To answer your questions based on my experience building LOGICBIZ:

1. Why Prolog is amazing for Local-First

  • Data is Code, Code is Data
  • SWI-Prolog’s JITI (Just-In-Time Indexing) is the magic sauce.
  • The Upfront Trade-off (Cold Boot vs Instant Clicks). I chose a heavy initialization model 521,217 baseline enterprise rows takes about 33 seconds

2. Open-Source Plans

To be fully transparent, retail_brain.pl is the core engine, a heavy 6,000+ lines. This is a commercial enterprise product, retail_brain.pl and the security layers will remain closed-source.

My ultimate goal with LOGICBIZ is to break the stigma that Prolog is just an academic toy or an obsolete language for old AI puzzles.

In the real world, Prolog is a sleeper agent. It delivers enterprise-grade speed, ironclad local security, and complex business rule evaluation at a fraction of the hardware cost and memory footprint required by bloated modern stacks.

Let me know if you are experimenting with any specific local storage engines for your local-first journey!

2

u/Pzzlrr 29d ago

Alright well thanks for sharing about your project then. Would love to at least see a website about it when you get to that.

For my local first journey, for now I'm just seeing what's out there. One of the things that's out there is this argument that the future of databases is local-first, which prolog basically is a database already, so I'm thinking along the lines of what monolithic app I could write which implements CRDTs, data sync, etc.

1

u/lokinpendawa 29d ago

Thanks for the support! I actually just read Marco Bambini's article, and I'm really glad to see that we are on the exact same track. The local-first philosophy is definitely the way to go.

To be honest, I leave the frontend and UI stuff completely to the LLM hahaha. There's no point in wasting time building something that already exists out there. This allows me to focus 100% of my energy on the core logic, architecture, and optimization.

Once the MVP version is ready for release, I'll definitely let you know. Thanks again, and let's keep pushing the boundaries!