The compact trie data structure.

Usage no npm install needed!

<script type="module">
  import smikhalevskiTrie from 'https://cdn.skypack.dev/@smikhalevski/trie';


trie build

The compact trie data structure.

npm install --save-prod @smikhalevski/trie


⚠️ API documentation is available here.

import {TrieMap} from '@smikhalevski/trie';

const trieMap = new TrieMap();

trieMap.set('foo', 123);

trieMap.get('foo'); // → 123

trieMap.search('aaafoobbb', 3);
// → {key: 'foo', value: 123, …}


Clone this repo and use npm ci && npm run perf to run the performance testsuite.

Search performance

Search performance chart