Skip to content

armgit / janas

Public Imported from GitHub
0

37 tok/s from Qwen3-Next-80B (48 GB) on a 32 GB laptop, 24 without drafts vs 2.8 for llama.cpp; reading 62 vs 16 tok/s. Faster than llama.cpp on all 13 models compared in Q4_K_M. LLMs bigger than your RAM, pure C, CPU or GPU.

866 B
Raw Blame
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 Maurizio Cammalleri
//
// One reply at a time, in the order asked: the model holds one
// conversation. The engine keeps its own order too; the line here makes a
// request's parameters and its reply one step, and says how many wait.

export class Line {
    private tail: Promise<void> = Promise.resolve();
    private count = 0;

    /** requests waiting or running */
    get length(): number {
        return this.count;
    }

    async run<T>(job: () => Promise<T>): Promise<T> {
        this.count++;
        const before = this.tail;
        let done!: () => void;
        this.tail = new Promise<void>((resolve) => (done = resolve));
        try {
            await before;
            return await job();
        } finally {
            this.count--;
            done();
        }
    }
}