Skip to content

Performance

advanced

Prefetch cache management, Rust acceleration status, and benchmarking.

Prefetch warmup

POST/v1/memory/prefetch/warmup

Pre-charge the prefetch cache for a given context.

context_keysarray[array[number]] | null

List of embedding vectors to prefetch around.

depthintegerDefault: 1

Prefetch depth (number of hops).

200Response
{
  "warmed_up": true,
  "patterns_prefetched": 42,
  "cache_size": 128
}
Tip

Also available via POST /v1/memory/diagnostics/prefetch/warmup (engine-advanced variant) which takes a single query embedding and returns patterns_prefetched and cluster_size.


Prefetch invalidate

DELETE/v1/memory/prefetch/invalidate

Invalidate the prefetch cache (useful after consolidation or context change).

200Response
{
  "cleared": true,
  "previous_cache_size": 128
}
Tip

Also available via POST /v1/memory/diagnostics/prefetch/invalidate (engine-advanced variant).


Acceleration status

GET/v1/memory/acceleration/status

Get Rust acceleration status and performance metrics.

200Response
{
  "rust_available": true,
  "operations_accelerated": [
    "cosine",
    "einsum",
    "hdc_bind"
  ],
  "speedup_factors": {
    "cosine": 12.5,
    "einsum": 8.3,
    "hdc_bind": 15.2
  },
  "fallback_to_python": false
}

Benchmark

POST/v1/memory/acceleration/benchmark

Run benchmark comparing Rust vs Python for critical operations.

operationsarray[string]Default: ["cosine", "einsum", "hdc_bind"]

Operations to benchmark.

n_iterationsintegerDefault: 100

Number of iterations per operation.

200Response
{
  "results": {
    "cosine": {
      "rust_ms": 0.08,
      "python_ms": 1,
      "speedup": 12.5
    },
    "einsum": {
      "rust_ms": 0.12,
      "python_ms": 1,
      "speedup": 8.3
    },
    "hdc_bind": {
      "rust_ms": 0.07,
      "python_ms": 1.06,
      "speedup": 15.2
    }
  },
  "n_iterations": 100,
  "total_duration_ms": 234
}

Next steps