# attractivechaos/klib

A standalone and lightweight C library

Repository: https://github.com/attractivechaos/klib
Canonical: https://ross.abutalabs.com/products/klib
Homepage: http://attractivechaos.github.io/klib/
Language: C
License: MIT
License Family: permissive
Topics: c, generic, library, hashtable, b-tree, avl-tree, sort, algorithm
Last push: 2025-12-22T04:59:43+00:00

## Health v2 (maintenance only)
Score: 58/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 58, release rhythm 35, longevity 100
- inputs: {"age_days": 5711, "days_push": 254, "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 4717, forks 594 (observed 2026-08-28T04:08:57.452185+00:00)

## What it is
Klib is a standalone, lightweight C library of generic data structures and algorithms implemented largely as single-header files using C macros. It includes efficient hash tables, B-trees, AVL trees, sorting routines, dynamic arrays, string utilities, and bioinformatics parsers like FASTA/FASTQ.

## Use cases
- add a fast hash table to a C project without dependencies
- sort large arrays efficiently in C
- parse FASTA/FASTQ bioinformatics files
- implement a B-tree or AVL tree in C
- parse command-line arguments in a portable C program
- build a dynamic array or linked list with minimal overhead

## When to choose
- you need high-performance generic containers in C with minimal footprint
- you want copy-paste single-file components with no library dependencies
- you are writing performance-critical or bioinformatics C code

## When to avoid
- you prefer clean, template-free APIs over macro-heavy code
- you need a full-featured container library like Glib with rich utilities
- you are working in a language other than C

## Facets
- artifact type: library
- maturity: stable
- function: parser, developer-tools, math
- domain: developer-tools, bioinformatics, performance
- platform: c, cross-platform, windows
- tags: hash-table, b-tree, avl-tree, sorting, dynamic-array, single-header, generic-programming, fasta-parser, smith-waterman, suffix-array, command-line-parsing, algorithms, linux, macos

## Member repositories
- attractivechaos/klib (main) score 58

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:57.452185+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-29T18:19:07.061865+00:00, confidence not recorded.
  - readme: https://github.com/attractivechaos/klib (fetched 2026-08-28T04:08:57.452185+00:00, sha 53bf9a958930)
  - homepage: http://attractivechaos.github.io/klib/ (fetched 2026-08-29T09:02:52.294894+00:00, sha 41a6b12d14c6)
- Data as of 2026-08-30T08:39:29.467469+00:00.
