MiniSearch alternative

Narsil vs MiniSearch

The benchmark harness measured Narsil and MiniSearch in Node.js for speed, ranking quality, and memory, and Narsil leads in every comparison.

34×

shorter median than MiniSearch

0.129ms median

When Narsil is embedded in a Node.js process, a keyword search over 50,000 documents takes a median of 0.129 ms.

  • Narsil0.129 ms
  • MiniSearch4.457 ms

A lower time means a faster search. On SciFact, Narsil ranks results at nDCG@10 0.684 and MiniSearch at 0.251.

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

The harness measured Narsil 0.4.5 against MiniSearch 7.2.0.

The harness tested each engine in a separate Node.js v24.22.3 process on GCP c3-standard-8, us-central1-a, on the processor that the machine reports as Intel(R) Xeon(R) Platinum 8481C CPU @ 2.70GHz.

What each engine is for

MiniSearch

MiniSearch is a small full-text search engine written in JavaScript that keeps its index in memory and has no dependencies. It offers prefix search, fuzzy search, and auto-suggestions, and it works in browsers and in Node.js.

Narsil

Narsil also embeds in a JavaScript process, and it adds vector, hybrid, and geo search, typed filters, and facets to full-text search. When an application outgrows one process, the same engine can serve the index over HTTP.

Keyword search

Each engine indexes the same FiQA documents and answers the same queries at each corpus size.

Keyword search, Keyword search
MeasureCorpusNarsilMiniSearch
Documents inserted a second1,000 documents12,1728,042
10,000 documents13,5846,840
50,000 documents13,0266,101
Median search, ms1,000 documents0.0490.079
10,000 documents0.0550.605
50,000 documents0.1294.457
p95 search, ms1,000 documents0.1120.511
10,000 documents0.1283.383
50,000 documents0.46828.965
Heap and external memory, MB1,000 documents1.16.7
10,000 documents6.641.6
50,000 documents23.1175.0

Filtered search

Each query adds a category filter and a minimum score filter to the search words.

The harness recorded no filtered search figures for MiniSearch.

Filtered search, Filtered search
MeasureCorpusNarsilMiniSearch
Median filtered search, ms1,000 documents0.052n/a
10,000 documents0.075n/a
50,000 documents0.150n/a

Ranking quality

Human relevance judgements on SciFact score each engine's top ten results.

Ranking quality, Ranking quality
MeasureCorpusNarsilMiniSearch
nDCG@10SciFact0.6840.251

Saving and loading

Each engine saves its largest index in its standard save format, then loads the saved copy and answers a search.

Saving and loading, Saving and loading
MeasureCorpusNarsilMiniSearch
Saved size, MB50,000 documents70.173.2
Save, ms50,000 documents1,3352,127
Load and first search, ms50,000 documents5321,528

Changing documents

Each engine removes a slice of its largest index, answers a search, and inserts the same number of documents again.

Changing documents, Changing documents
MeasureCorpusNarsilMiniSearch
Documents removed a second50,000 documents7,9291,155
Search after removal, ms50,000 documents0.1914.290
Documents inserted again a second50,000 documents9,7235,732

Where Narsil is better

  • Narsil keeps text, vectors, and coordinates in one typed index, so a single query can combine text, vector, and geo conditions.
  • Narsil keeps each index durable with a write-ahead log and checkpoints.
  • Narsil packages for Python, Go, and Rust read the same index format, so services outside JavaScript can search the same index.

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

A measure is level when the tables above show the same figure for both engines.

Where MiniSearch is better

  • MiniSearch is a small library with no dependencies, so it adds little to a browser bundle.
  • MiniSearch is written in plain JavaScript with no native code, so the same package works in every JavaScript runtime, while Narsil loads a native core outside the browser.

Measurements that MiniSearch won

The harness recorded no measurement in which MiniSearch 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.

See what your agent does with it

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.

Serve Narsil over HTTP
pnpm add @delali/narsil
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()

Reproduce these numbers

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

git clone https://github.com/assetcorp/narsil.git
cd narsil
pnpm install
pnpm run build
pnpm --filter benchmarks bench