Java Clean Architecture Masterclass

Java Clean Architecture MasterclassNov 20-21

Join

Pathetic 🥀

The pathfinding library that's too good for this pathetic world.

Mentioned in Awesome Java Maven Central Build Status License

“I used to use library X… then I tried Pathetic and suddenly my server stopped crying.”
— every future user, probably

Listen up, peasants

It exists for one simple reason: The rest of the Java pathfinding world collectively shits itself above a few hundred concurrent requests.

Scenario Pathetic The "competition" Your tears
10k concurrent paths ~7 ms ~300 ms + Priceless
One 20k distance path ~60 ms Minutes, timeout, or suicide We measured twice
CPU when the world burns <2% on 16 cores 20–100% or instant OOM Eco-mode
Memory Spark shows a flat line Hundreds of MB of GC tears Spark thinks nothing happened

ezgif-425417d69c8935bb ezgif-47d8f87ff2b608e9

All demos from a real Paper server.
Minecraft is a pathfinding hell — Pathetic just walked in, pissed on Hades' leg, and asked for a lighter.

Most libraries need minutes or give up entirely on paths longer than 1000 positions.
Pathetic does 20 000 in the time you need to blink twice.
You're welcome.

Drop-in and watch the magic

<dependencies>
    <dependency>
        <groupId>de.bsommerfeld.pathetic</groupId>
        <artifactId>engine</artifactId>
        <version>LATEST</version>
    </dependency>
    <dependency>
        <groupId>de.bsommerfeld.pathetic</groupId>
        <artifactId>api</artifactId>
        <version>LATEST</version>
    </dependency>
</dependencies>
implementation("de.bsommerfeld.pathetic:engine:LATEST")
implementation("de.bsommerfeld.pathetic:api:LATEST")
Pathfinder pf = factory.createPathfinder(config);

pf.findPath(start, goal, context).thenAccept(result -> {
    if (result.state() == FOUND) moveThatEntity(result.path());
});

Features that hurt other libraries' feelings

Yeah but how is it actually this fast?

We used to use FibonacciHeaps like all the other “serious” libraries.
It was fine.
It was fast enough.
It was also allocating objects like a crypto miner on Christmas.

So we took it out back and replaced it with a hand-rolled, array-backed, zero-allocation primitive binary heap.

What changed?

Metric Old FibonacciHeap New PrimitiveMinHeap Your server now
Allocations per run Objects everywhere 0 (Zero. Zilch. Nada.) GC went on vacation
Cache efficiency Pointer chasing hell Contiguous array bliss CPU utilization dropped 50 %
Benchmark (1k nodes) Baseline ~4.5Ă— faster Teleportation enabled
Benchmark (10k nodes) Baseline ~3Ă— faster Your players noticed
Large Scale (50k nodes) Exponential degradation Linearly stable The dragon never stood a chance

Result: 10 000 concurrent pathfinds now finish before you can blink.

We kept the old FibonacciHeap code in a branch called archaeology.

We could’ve called it HyperQuantumPathUltra Enterprise God Mode Edition™

We called it Pathetic instead.
Because that’s what every other library became the moment we released this.

Some say "this README reads like they belong in a hospital."
And you're goddamn right.


Hang out with us

Wiki – for mortals who still read docs
Discord – come cry or worship
Issues, PRs, death threats → right here: https://github.com/bsommerfeld/pathetic/issues

Powered by JetBrains (they saw the name and still sponsored us – legends recognize legends ❤️)
JetBrains logo.

Join libs.tech

...and unlock some superpowers

GitHub

We won't share your data with anyone else.