Blog / How-to guides

Store a 1 MB document in memory, and time it on your machine

28 October 2026 · Semurg · 3 min read · Markdown

Last checked on r11.134.20261027.a9b1536 (27 Oct 2026): every command below ran on a fresh node of that release. The current release is r11.135.20261028.2ff2348 (28 Oct 2026), and the commands have not been re-checked on it yet (how)

memorydocumentsperformancehow-to

A 1 MB text document stores in about 1.8 seconds on our test machine (1.8 s, 1.7 s and 1.8 s over three runs, on the release published on 27 October 2026).[1] We measured it on one machine, 16 cores with the node in a container limited to 8 GB of memory, with the meeting notes the program below writes. The program prints your own time.

Time it yourself

You need a running node (install one; the installer prints the node's API token, and on the Docker route it is in the container's log) and the Python client in its own environment, with the token set in the same shell:

bash
python3 -m venv ~/semurg-venv && . ~/semurg-venv/bin/activate
pip install semurg
export SEMURG_API_TOKEN=<your token>

The program first tells the memory about 200 people and 20 companies, so the document has names to recognise, then stores about 1 MB of meeting notes that mention them, and asks one question of what it stored. Save it to a file and run it with python3.

python
import os, time
from semurg import Client

c = Client("http://127.0.0.1:4000", token=os.environ["SEMURG_API_TOKEN"])
scope = "meeting-notes"

first = ["Ada", "Grace", "Alan", "Edsger", "Barbara", "Donald", "Margaret", "Ken", "Dennis", "Frances",
         "John", "Radia", "Leslie", "Tony", "Shafi", "Niklaus", "Hedy", "Claude", "Katherine", "Tim"]
last = ["Lovelace", "Hopper", "Turing", "Dijkstra", "Liskov", "Knuth", "Hamilton", "Thompson", "Ritchie", "Allen"]
people = [f"{f} {l}" for f in first for l in last]
companies = [f"{n} Holdings" for n in ["Acme", "Globex", "Initech", "Umbrella", "Stark", "Wayne", "Tyrell", "Cyberdyne",
                                        "Soylent", "Hooli", "Vandelay", "Wonka", "Gringotts", "Monarch", "Oscorp", "Pied Piper",
                                        "Aperture", "Black Mesa", "Massive Dynamic", "Wernham Hogg"]]

# 200 people and 20 companies the memory already knows
c.remember(scope, facts={
    "entities": [{"name": p, "type": "Person"} for p in people] + [{"name": k, "type": "Company"} for k in companies],
    "relations": [{"source": p, "target": companies[i % 20], "type": "WORKS_AT"} for i, p in enumerate(people)],
})

# about 1 MB of meeting notes that mention them
lines, size, i = [], 0, 0
while size < 1_000_000:
    a, b, k = people[i % 200], people[(i * 7 + 3) % 200], companies[(i * 3) % 20]
    line = f"Meeting {i}: {a} and {b} reviewed the {k} contract, agreed the delivery date and asked finance for revised figures."
    lines.append(line)
    size += len(line) + 1
    i += 1
doc = "\n".join(lines)

t0 = time.perf_counter()
c.document(scope, doc, name="meeting-notes.txt")
print(f"stored {len(doc.encode()) / 1e6:.2f} MB in {time.perf_counter() - t0:.2f} s")

answer = c.context(scope, "Who reviewed the Acme Holdings contract?", compact=True)
print(f"answer: {answer.get('state')}, {answer.get('grounding', {}).get('state')}, {len(answer.get('items', []))} items")

Expected: the document is stored and the question is answered from it

The first line is your time. The second says the question was answered from what you stored: grounded means the cited items cover the question.

This post was written with AI assistance. Every result in it is checked against a published release or record before the post goes out.

How these commands were checked

Our test farm ran each of the 1 command block marked runnable, exactly as written, with the answer checked against the expectation printed under it, against a fresh node of the published release r11.134.20261027.a9b1536. A post is published only when every one of them passed there.

Evidence

  1. Release r11.132.20261027.a274a28, published on one.semurg.io (release:r11.132.20261027.a274a28; the record as JSON)

Related