# tidwall/btree

B-tree implementation for Go

Repository: https://github.com/tidwall/btree
Canonical: https://ross.abutalabs.com/products/tidwall-btree
Language: Go
License: MIT
License Family: permissive
Last push: 2026-05-17T00:46:55+00:00

## Health v2 (maintenance only)
Score: 69/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 82, release rhythm 35, longevity 100
- inputs: {"age_days": 3754, "days_push": 109, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1226, forks 105 (observed 2026-08-28T04:04:03.080801+00:00)

## What it is
A fast, generic B-tree implementation for Go providing ordered Map, Set, and thread-safe BTree types. It supports bulk loading, copy-on-write copies, path hinting, and array-like index operations.

## Use cases
- store ordered key-value pairs in Go
- implement an in-memory sorted set
- bulk load presorted data into a tree
- iterate keys in ascending or descending order
- perform array-like indexed access on sorted data
- replace Go's built-in map when sorted iteration is needed

## When to choose
- you need sorted iteration or range scans over keys in Go
- you want a fast pure-Go ordered map/set with generics
- you need copy-on-write snapshots or bulk loading of presorted data

## When to avoid
- you only need an unordered key-value store (use the built-in map)
- you need persistence or disk-backed storage
- you need concurrent access with heavy write contention beyond its locking model

## Facets
- artifact type: library
- maturity: stable
- function: database, developer-tools
- domain: databases, developer-tools
- platform: go, cross-platform
- tags: b-tree, data-structures, generics, ordered-map, ordered-set, copy-on-write, algorithms

## Member repositories
- tidwall/btree (main) score 69

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:03.080801+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:15:21.327389+00:00, confidence not recorded.
  - readme: https://github.com/tidwall/btree (fetched 2026-08-28T04:04:03.080801+00:00, sha 880abe3893e0)
- Data as of 2026-08-30T08:39:29.467469+00:00.
