Skip to content

Commit f4dc669

Browse files
authored
Merge pull request #73 from devlux76/copilot/p3-subtask-creation
feat(P3): WebGL provider, ExperienceReplay, ClusterStability, benchmark suite, hotpath guard, docs
2 parents e6fc325 + 0341e62 commit f4dc669

19 files changed

Lines changed: 2920 additions & 1 deletion

benchmarks/BASELINES.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# CORTEX Benchmark Baselines
2+
3+
> **Status:** Baseline measurements pending a hardware CI run.
4+
> The values below are illustrative targets; replace with real output from
5+
> `npm run benchmark:all` on representative hardware.
6+
7+
## Williams Bound H(t) — Sublinear Growth Curve
8+
9+
| Graph mass (t) | H(t) = ceil(0.5 * sqrt(t * log2(1+t))) | H(t)/t ratio |
10+
|---------------:|----------------------------------------:|-------------:|
11+
| 1 000 | ~22 | 0.022 |
12+
| 10 000 | ~99 | 0.010 |
13+
| 100 000 | ~408 | 0.004 |
14+
| 1 000 000 | ~1 576 | 0.002 |
15+
16+
Key invariant: H(t)/t strictly decreases as t grows.
17+
18+
---
19+
20+
## Dummy Embedder Hotpath
21+
22+
Run: `npm run benchmark:dummy`
23+
24+
| Benchmark | Mean latency (ms) | Throughput |
25+
|-------------------------|------------------:|----------:|
26+
| Single short input | TBD | TBD |
27+
| Batch 16 medium inputs | TBD | TBD |
28+
| Batch 64 short inputs | TBD | TBD |
29+
30+
---
31+
32+
## Query Latency vs Corpus Size
33+
34+
Run: `npm run benchmark:query-latency`
35+
36+
| Corpus size | Mean query latency (ms) |
37+
|------------:|------------------------:|
38+
| 100 pages | TBD |
39+
| 500 pages | TBD |
40+
41+
Expected: latency grows sub-linearly because hotpath residents are scored
42+
first and most queries are served without scanning the full corpus.
43+
44+
---
45+
46+
## Storage Overhead
47+
48+
Run: `npm run benchmark:storage-overhead`
49+
50+
| Page count | Vector store size (bytes) | Bytes per page |
51+
|-----------:|--------------------------:|---------------:|
52+
| 50 | TBD | TBD |
53+
| 200 | TBD | TBD |
54+
55+
Expected: linear growth (no hidden quadratic allocations).
56+
57+
---
58+
59+
## Hotpath Scaling
60+
61+
Run: `npm run benchmark:hotpath-scaling`
62+
63+
| Graph mass | H(t) capacity | Resident count | Promotion sweep (ms) |
64+
|-----------:|--------------:|---------------:|---------------------:|
65+
| 1 000 | ~22 | TBD | TBD |
66+
| 5 000 | ~55 | TBD | TBD |
67+
68+
Invariant: Resident count never exceeds H(t).
69+
70+
---
71+
72+
## How to Update Baselines
73+
74+
1. Run `npm run benchmark:all` on the target hardware.
75+
2. Copy the `mean` column values from the Vitest bench output.
76+
3. Replace every `TBD` cell in this file with the measured value.
77+
4. Commit with message `chore: update benchmark baselines — <hardware>`.

core/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ export interface MetadataStore {
164164

165165
putVolume(volume: Volume): Promise<void>;
166166
getVolume(volumeId: Hash): Promise<Volume | undefined>;
167+
/**
168+
* Delete a volume record and clean up all reverse-index entries
169+
* (`bookToVolume` for each book in the volume, and the `volumeToShelf` entry).
170+
* Callers are responsible for removing the volume from any shelf's `volumeIds`
171+
* list before calling this method.
172+
*/
173+
deleteVolume(volumeId: Hash): Promise<void>;
167174

168175
putShelf(shelf: Shelf): Promise<void>;
169176
getShelf(shelfId: Hash): Promise<Shelf | undefined>;

0 commit comments

Comments
 (0)