# attaswift/BTree

Fast sorted collections for Swift using in-memory B-trees

Repository: https://github.com/attaswift/BTree
Canonical: https://ross.abutalabs.com/products/attaswift-btree
Language: Swift
License: MIT
License Family: permissive
Topics: btree, collection, orderedcollection, swift, search-trees
Last push: 2022-02-23T10:17:30+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 3915, "days_push": 1652, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1323, forks 73 (observed 2026-08-28T04:04:22.218332+00:00)

## What it is
A pure Swift library providing efficient in-memory B-tree implementations and sorted collection types like Map, List, SortedSet, and SortedBag. It offers logarithmic-complexity alternatives to Swift's standard Dictionary, Array, and Set with strong worst-case performance guarantees.

## Use cases
- sorted dictionary in Swift without hashable keys
- fast insertion and removal at arbitrary indices in a list
- sorted set with efficient set operations
- sorted multiset (bag) implementation
- persistent ordered collections with O(log n) operations

## When to choose
- you need sorted collections with guaranteed logarithmic worst-case performance in Swift
- your keys are comparable but not hashable
- you frequently concatenate, splice, or extract subranges of large lists

## When to avoid
- you only need simple dictionaries or arrays with typical small data sizes
- you need actively maintained dependencies with recent Swift concurrency support
- you require on-disk or database-backed B-trees rather than in-memory structures

## Facets
- artifact type: library
- maturity: maintenance
- function: search-engine
- domain: developer-tools, performance
- platform: cross-platform
- tags: btree, sorted-collections, swift-package, data-structures, algorithms, macos, ios, swift

## Member repositories
- attaswift/BTree (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:22.218332+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-30T04:47:03.913866+00:00, confidence not recorded.
  - readme: https://github.com/attaswift/BTree (fetched 2026-08-28T04:04:22.218332+00:00, sha 031ba9606649)
- Data as of 2026-08-30T08:39:29.467469+00:00.
