attractivechaos/klib

A standalone and lightweight C library

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 15 seconds ago
Type:Library / SDKCategory(s):Core & Utility LibrariesLanguages & Runtimes
Added to GitGenius on September 14th, 2026
Created on January 13th, 2011
Open Issues & Pull Requests: 95 (+0)
GitHub issues: Enabled
Number of forks: 596
Total Stargazers: 4,723 (+0)
Total Subscribers: 187 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 289.8 days
Mean response time: 289.8 days
90th percentile: 289.8 days
Tracked items: 1

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 5
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 371 days
Stale 30+ days: 5
Stale 90+ days: 3

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Klib is a standalone and lightweight C library that provides generic implementations of common data structures and algorithms including hash tables, B-trees, AVL trees, sorting routines, and dynamic arrays.

The library addresses the need for efficient generic programming in C without external dependencies. Rather than using void pointers like some other C libraries, klib relies on C macros to instantiate type-specific versions of generic containers. This macro-based approach allows the resulting code to match the performance of hand-written type-specific implementations while avoiding the memory overhead and speed penalties of pointer-based generics. Components are designed to be independent, so developers can copy only the files they need into their project without managing library dependencies beyond the standard C library.

Klib suits projects where efficiency and minimal footprint matter: embedded systems, performance-critical applications, and codebases that prefer self-contained components over external dependencies. The library is particularly strong in sorting algorithms, hash tables, and tree structures, with implementations claimed to rank among the fastest in any language. Developers should expect that using generic containers requires understanding the macro instantiation pattern, which can make code less conventional and harder to debug than traditional approaches. The README contrasts klib's macro-based generics with void-pointer approaches used by libraries like Glib, noting performance and memory advantages.

The project maintains a broad set of components spanning general-purpose data structures, specialized algorithms for bioinformatics tasks like sequence parsing and Smith-Waterman alignment, and utility functions including command-line parsing and remote file access. Development activity shows consistent refinement of existing components rather than rapid feature expansion, with attention to performance optimization across the library's core offerings.