> Complete content index: https://narsil.sondelali.com/llms.txt

# Narsil vs Typesense

> The benchmark harness measured Narsil and Typesense for ranking quality, speed, and ingest, and Narsil leads in every comparison.

URL: https://narsil.sondelali.com/compare/typesense

## Headline result

On DBpedia 1M keyword search with equal settings, Narsil answers 11 times as many searches a second as Typesense.

Ratio: 11× (Typesense's rate).

- Narsil Rust: 11,792
- Narsil TypeScript: 8,459
- Typesense: 1,052

The DBpedia 1M set contains no human relevance judgements, so the harness reports no nDCG@10 for it.

The harness recorded these figures in run `20261119T135007Z` on 19 November 2026, with Narsil built from commit `3ad47df2c9c1`.

The harness measured Narsil `0.4.5` against Typesense `30.2`.

The harness tested Narsil TypeScript on GCP c3-standard-8, us-central1-a; Narsil Rust on GCP c3-standard-8, us-east1-b; and Typesense on GCP c3-standard-8, us-west2-a, each on the processor that its machine reports as Intel(R) Xeon(R) Platinum 8481C CPU @ 2.70GHz.

## What each engine is for

**Typesense.** Typesense is an open source search engine written in C++ that keeps its index in memory. It focuses on typo-tolerant search as you type, and you can deploy it yourself or use Typesense Cloud.

**Narsil.** Narsil ranks keyword results with BM25 and adds vector, hybrid, and geo search on the same typed index. You can embed it in a TypeScript, Python, Go, or Rust process, or you can deploy the same engine as a server with a REST API.

## Equal settings

Every engine stores full-precision vectors. On the vector track, the harness raises each engine's search effort until that engine reaches an ANN recall@10 of 0.99, before it measures the engine's speed.

| Dataset | Engine | nDCG@10 | Recall@100 | Ingest docs/s | p50 ms | p99 ms | Peak QPS |
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |
| SciFact | Narsil TypeScript | 0.681 | 0.925 | 4,421 | 0.34 | 0.80 | 34,198 (34,169 to 34,213) |
| SciFact | Narsil Rust | 0.681 | 0.925 | 7,529 | 0.26 | 0.40 | 56,315 (56,271 to 56,361) |
| SciFact | Typesense | 0.550 | 0.751 | 2,115 | 13.07 | 64.10 | 333 (330 to 334) |
| NFCorpus | Narsil TypeScript | 0.328 | 0.249 | 4,402 | 0.32 | 0.71 | 51,462 (51,319 to 51,564) |
| NFCorpus | Narsil Rust | 0.328 | 0.249 | 6,717 | 0.22 | 0.31 | 94,225+ (93,724 to 94,639) |
| NFCorpus | Typesense | 0.242 | 0.209 | 1,968 | 0.82 | 9.80 | 4,355 (4,333 to 4,364) |
| DBpedia 100K | Narsil TypeScript | n/a | n/a | 18,039 | 0.30 | 0.64 | 33,054 (32,983 to 33,102) |
| DBpedia 100K | Narsil Rust | n/a | n/a | 35,693 | 0.24 | 0.52 | 53,510 (53,422 to 53,637) |
| DBpedia 100K | Typesense | n/a | n/a | 9,098 | 1.20 | 18.60 | 3,429 (3,426 to 3,438) |
| DBpedia 1M | Narsil TypeScript | n/a | n/a | 18,512 | 0.54 | 2.12 | 8,459 (8,380 to 8,498) |
| DBpedia 1M | Narsil Rust | n/a | n/a | 22,032 | 0.58 | 1.99 | 11,792 (11,749 to 11,803) |
| DBpedia 1M | Typesense | n/a | n/a | 7,610 | 2.73 | 49.48 | 1,052 (1,048 to 1,067) |

A highlighted figure is the best in its column for that dataset.

p50 is the median search time and p99 is the time within which 99% of searches finished, as the client measured them. The table shows each peak with its 95% interval.

A + after a peak means that the load generator reached its limit before the engine did, so the engine's real peak is at least that figure.

The tables show n/a for nDCG@10 and Recall@100 on the DBpedia sets, because those sets contain no human relevance judgements.

## Where Narsil is better

- Narsil ranks keyword results with BM25, calibrated against Anserini, the Lucene toolkit for information-retrieval research.
- Narsil can work inside your application process, where it answers each search without a network call. Once you need a server, a Narsil server can load that same index without any change.
- Narsil keeps text, vectors, and coordinates in one typed index, so a single query can combine text, vector, and geo conditions.

Of the 28 measurements that the harness recorded for both engines, Narsil came out ahead in 28 and Typesense in 0.

A peak is level when the two 95% intervals overlap, or when the load generator capped the lower peak, because that figure is then a lower bound. Every other measure is level when the tables above show the same figure for both engines.

### nDCG@10

Narsil better in 4 of 4.

| Comparison | Narsil | Typesense |
| --- | ---: | ---: |
| Keyword, SciFact (Narsil TypeScript) | 0.681 | 0.550 |
| Keyword, SciFact (Narsil Rust) | 0.681 | 0.550 |
| Keyword, NFCorpus (Narsil TypeScript) | 0.328 | 0.242 |
| Keyword, NFCorpus (Narsil Rust) | 0.328 | 0.242 |

### Peak queries a second

Narsil better in 8 of 8.

| Comparison | Narsil | Typesense |
| --- | ---: | ---: |
| Keyword, SciFact (Narsil TypeScript) | 34,198 | 333 |
| Keyword, SciFact (Narsil Rust) | 56,315 | 333 |
| Keyword, NFCorpus (Narsil TypeScript) | 51,462 | 4,355 |
| Keyword, NFCorpus (Narsil Rust) | 94,225 | 4,355 |
| Keyword, DBpedia 100K (Narsil TypeScript) | 33,054 | 3,429 |
| Keyword, DBpedia 100K (Narsil Rust) | 53,510 | 3,429 |
| Keyword, DBpedia 1M (Narsil TypeScript) | 8,459 | 1,052 |
| Keyword, DBpedia 1M (Narsil Rust) | 11,792 | 1,052 |

### Median client latency, ms

Narsil better in 8 of 8.

| Comparison | Narsil | Typesense |
| --- | ---: | ---: |
| Keyword, SciFact (Narsil TypeScript) | 0.34 | 13.07 |
| Keyword, SciFact (Narsil Rust) | 0.26 | 13.07 |
| Keyword, NFCorpus (Narsil TypeScript) | 0.32 | 0.82 |
| Keyword, NFCorpus (Narsil Rust) | 0.22 | 0.82 |
| Keyword, DBpedia 100K (Narsil TypeScript) | 0.30 | 1.20 |
| Keyword, DBpedia 100K (Narsil Rust) | 0.24 | 1.20 |
| Keyword, DBpedia 1M (Narsil TypeScript) | 0.54 | 2.73 |
| Keyword, DBpedia 1M (Narsil Rust) | 0.58 | 2.73 |

### Documents ingested a second

Narsil better in 8 of 8.

| Comparison | Narsil | Typesense |
| --- | ---: | ---: |
| Keyword, SciFact (Narsil TypeScript) | 4,421 | 2,115 |
| Keyword, SciFact (Narsil Rust) | 7,529 | 2,115 |
| Keyword, NFCorpus (Narsil TypeScript) | 4,402 | 1,968 |
| Keyword, NFCorpus (Narsil Rust) | 6,717 | 1,968 |
| Keyword, DBpedia 100K (Narsil TypeScript) | 18,039 | 9,098 |
| Keyword, DBpedia 100K (Narsil Rust) | 35,693 | 9,098 |
| Keyword, DBpedia 1M (Narsil TypeScript) | 18,512 | 7,610 |
| Keyword, DBpedia 1M (Narsil Rust) | 22,032 | 7,610 |

## Where Typesense is better

- Typesense replicates its index across a cluster of nodes, so searches keep returning results when one node fails.
- Typesense Cloud operates Typesense clusters for you.
- Typesense provides an adapter for InstantSearch, so you can build a search interface from ready-made components.

Measurements that Typesense won:

The harness recorded no measurement in which Typesense came out ahead.

## Try Narsil

When you paste this prompt into your coding agent, the agent will install the Narsil skill and the package, then build and test the search that your project needs.

```text
Read https://narsil.sondelali.com/agents.md and follow it to add Narsil search to this project.
```

If you prefer to write the code yourself, you can use the Narsil package for TypeScript, Python, Go, or Rust, since every package searches with the same engine. Each program indexes three films and finds the films from 1990 onwards whose title matches ronin, before it finds the two films whose embeddings are closest to a query vector.

```bash title="pnpm" tab="TypeScript"
pnpm add @delali/narsil
```

```bash title="pip" tab="Python"
pip install delali-narsil
```

```bash title="go get" tab="Go"
go get github.com/assetcorp/narsil/packages/go/engine@v0.2.1
```

```bash title="cargo" tab="Rust"
cargo add delali-narsil
```

```ts title="films.ts" tab="TypeScript"
import { createNarsil } from '@delali/narsil'

const narsil = await createNarsil()

await narsil.createIndex('films', {
  schema: { title: 'string', year: 'number', embedding: 'vector[3]' },
})

await narsil.insertBatch('films', [
  { id: 'heat', title: 'Heat', year: 1995, embedding: [0.9, 0.1, 0.2] },
  { id: 'ronin', title: 'Ronin', year: 1998, embedding: [0.8, 0.3, 0.1] },
  { id: 'solaris', title: 'Solaris', year: 1972, embedding: [0.1, 0.9, 0.7] },
])

const keyword = await narsil.query('films', { term: 'ronin', filters: { fields: { year: { gte: 1990 } } } })
console.log(keyword.count, keyword.hits[0].id)

const nearest = await narsil.query('films', {
  vector: { field: 'embedding', value: [0.85, 0.2, 0.15] },
  limit: 2,
})
for (const hit of nearest.hits) {
  console.log(hit.id, hit.score)
}

await narsil.shutdown()
```

```python title="films.py" tab="Python"
from narsil import Narsil

with Narsil() as engine:
    engine.create_index("films", {"schema": {"title": "string", "year": "number", "embedding": "vector[3]"}})
    engine.insert_batch(
        "films",
        [
            {"id": "heat", "title": "Heat", "year": 1995, "embedding": [0.9, 0.1, 0.2]},
            {"id": "ronin", "title": "Ronin", "year": 1998, "embedding": [0.8, 0.3, 0.1]},
            {"id": "solaris", "title": "Solaris", "year": 1972, "embedding": [0.1, 0.9, 0.7]},
        ],
    )

    keyword = engine.query("films", {"term": "ronin", "filters": {"fields": {"year": {"gte": 1990}}}})
    print(keyword["count"], keyword["hits"][0]["id"])

    nearest = engine.query("films", {"vector": {"field": "embedding", "value": [0.85, 0.2, 0.15]}, "limit": 2})
    for hit in nearest["hits"]:
        print(hit["id"], hit["score"])
```

```go title="main.go" tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/assetcorp/narsil/packages/go/engine"
)

func main() {
	if err := run(context.Background(), "./narsil-data"); err != nil {
		log.Fatal(err)
	}
}

func run(ctx context.Context, directory string) error {
	narsil, err := engine.New(ctx, engine.Config{
		Durability: &engine.DurabilityConfig{Directory: directory},
	})
	if err != nil {
		return err
	}
	defer narsil.Shutdown(ctx)

	err = narsil.CreateIndex(ctx, "films", engine.IndexConfig{
		Schema: engine.Schema{
			"title":     engine.FieldString,
			"year":      engine.FieldNumber,
			"embedding": engine.VectorFieldType(3),
		},
	})
	if err != nil {
		return err
	}

	_, err = narsil.InsertBatch(ctx, "films", []*engine.Document{
		engine.DocumentFromMap(map[string]any{"id": "heat", "title": "Heat", "year": 1995, "embedding": []float32{0.9, 0.1, 0.2}}),
		engine.DocumentFromMap(map[string]any{"id": "ronin", "title": "Ronin", "year": 1998, "embedding": []float32{0.8, 0.3, 0.1}}),
		engine.DocumentFromMap(map[string]any{"id": "solaris", "title": "Solaris", "year": 1972, "embedding": []float32{0.1, 0.9, 0.7}}),
	}, engine.InsertOptions{})
	if err != nil {
		return err
	}

	keyword, err := narsil.Query(ctx, "films", engine.QueryParams{
		Term: "ronin",
		Filters: &engine.FilterExpression{Fields: map[string]engine.FieldFilter{
			"year": {Gte: engine.NumberBound(1990)},
		}},
	})
	if err != nil {
		return err
	}
	fmt.Println(keyword.Count, keyword.Hits[0].ID)

	nearest, err := narsil.Query(ctx, "films", engine.QueryParams{
		Mode:   engine.SearchVector,
		Vector: &engine.VectorQueryConfig{Field: "embedding", Value: []float32{0.85, 0.2, 0.15}},
		Limit:  engine.Some(2),
	})
	if err != nil {
		return err
	}
	for _, hit := range nearest.Hits {
		fmt.Println(hit.ID, hit.Score.Or(0))
	}
	return nil
}
```

```rust title="main.rs" tab="Rust"
use narsil::{IndexConfig, Narsil, NarsilConfig, QueryParams, Value, VectorQuery, parse_json};

fn main() -> narsil::Result<()> {
    let engine = Narsil::open(NarsilConfig::default())?;
    engine.create_index(
        "films",
        IndexConfig {
            schema: parse_json(r#"{ "title": "string", "year": "number", "embedding": "vector[3]" }"#)?,
            ..IndexConfig::default()
        },
    )?;

    let films = [
        r#"{ "id": "heat", "title": "Heat", "year": 1995, "embedding": [0.9, 0.1, 0.2] }"#,
        r#"{ "id": "ronin", "title": "Ronin", "year": 1998, "embedding": [0.8, 0.3, 0.1] }"#,
        r#"{ "id": "solaris", "title": "Solaris", "year": 1972, "embedding": [0.1, 0.9, 0.7] }"#,
    ];
    let mut documents = Vec::new();
    for film in films {
        if let Value::Object(document) = parse_json(film)? {
            documents.push(document);
        }
    }
    engine.insert_batch("films", documents)?;

    let keyword = engine.query(
        "films",
        &QueryParams {
            term: Some("ronin".into()),
            filters: Some(parse_json(r#"{ "fields": { "year": { "gte": 1990 } } }"#)?),
            ..QueryParams::default()
        },
    )?;
    println!("{} {}", keyword.count, keyword.hits[0].id);

    let nearest = engine.query(
        "films",
        &QueryParams {
            vector: Some(VectorQuery {
                field: "embedding".into(),
                value: Some(vec![0.85, 0.2, 0.15]),
                ..VectorQuery::default()
            }),
            limit: Some(2),
            ..QueryParams::default()
        },
    )?;
    for hit in &nearest.hits {
        println!("{} {}", hit.id, hit.score.unwrap_or(0.0));
    }
    Ok(())
}
```

- [Serve Narsil over HTTP](https://narsil.sondelali.com/docs/http-server)

## Reproduce these numbers

The benchmark harness is in the Narsil repository, where it writes every figure that it measures into a new run directory.

```bash
git clone https://github.com/assetcorp/narsil.git
cd narsil/benchmarks/server
./run-all.sh narsil narsil-rust typesense
```

- [Open the run on GitHub](https://github.com/assetcorp/narsil/tree/main/benchmarks/server/results/runs/20261119T135007Z)
- [Compare every engine in BENCHMARKS.md](https://github.com/assetcorp/narsil/blob/main/BENCHMARKS.md)
