finds.dev← search

// the find

jeresig/trie-js

★ 260 · JavaScript · updated May 2016

A simple Trie implementation for Node.js.

A trie implementation in JavaScript by John Resig, built around 2011 to explore different trie encodings (binary, succinct, suffix, hash, string) for dictionary lookups in Node.js. It's an educational artifact showing the performance tradeoffs between representations, not a drop-in library.

Multiple encoding strategies are compared side by side (binary, succinct, suffix, hash), which is genuinely useful for understanding the space/time tradeoffs. The benchmark setup with Benchmark.js makes it straightforward to run comparisons yourself. Resig wrote a companion blog post with analysis, so there's context for why each variant exists. The code is small enough to actually read in an afternoon.

Abandoned for a decade — last touched in 2016, originally written in 2011, no npm package, no TypeScript types. There's no proper API surface: you build a trie by running a script that writes a JS file to disk, which isn't how anyone wants to use a data structure library. No insert or delete operations — it's read-only once built. Any modern alternative (e.g. `trie-typed` or just a Map-based prefix structure) will be better maintained and easier to integrate.

View on GitHub →

// want more like this?

Every week we dig through GitHub and send you a few repos picked for what you're working on, each with an honest take like this one. Free. See a real issue →

// similar repos

Search the finds →