{"id":16842637,"url":"https://github.com/rofl0r/htab","last_synced_at":"2025-04-11T05:52:10.381Z","repository":{"id":65631252,"uuid":"294586885","full_name":"rofl0r/htab","owner":"rofl0r","description":"simple and efficient hashtable implementation for C, taken from musl's hsearch()","archived":false,"fork":false,"pushed_at":"2023-02-01T15:57:04.000Z","size":21,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T05:52:05.783Z","etag":null,"topics":["c","efficient","fast","hashmap","hashtable"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rofl0r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-11T03:42:35.000Z","updated_at":"2024-12-18T23:59:21.000Z","dependencies_parsed_at":"2023-02-17T07:31:21.570Z","dependency_job_id":null,"html_url":"https://github.com/rofl0r/htab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fhtab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fhtab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fhtab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fhtab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofl0r","download_url":"https://codeload.github.com/rofl0r/htab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351409,"owners_count":21089271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","efficient","fast","hashmap","hashtable"],"created_at":"2024-10-13T12:47:30.337Z","updated_at":"2025-04-11T05:52:10.360Z","avatar_url":"https://github.com/rofl0r.png","language":"C","readme":"htab - a simple and efficient hashtable for C\n=============================================\n\nthis is the hashtable implementation used by musl libc's hsearch() function\n(originally authored by Szabolcs Nagy aka nsz), refactored to provide a nicer\nand threadsafe API and enhanced with a delete and an iterator function.\n\ni've been looking for a good general-purpose hashtable implementation for C\nfor a while, but what i found wasn't really satisfactory.\n\nmost are really complex, hard to use and one can only hope they're not full\nof bugs. some of them provide type safety but use non-standard extensions\nlike `typeof`, others expand macros that span over dozens or even hundreds of\nlines.\n\nmy requirements were basically:\n\n- fast\n- simple to use\n- bug-free\n- well-tested\n- well-documented or self-explanatory\n- contained in one source file and header\n- readable\n- as little code as possible\n- liberally licensed (MIT or PD)\n\nwhen i found out that POSIX provides a built-in `hsearch` hashtable\nimplementation (which, however has an odd interface, is not threadsafe,\nand lacks delete and iterator functions), i figured that the best i could come\nup with is to take musl's version and adapt it to my needs.\nand indeed, the result satisfies every single requirement from the above list.\nthe code is less than 200 lines, easily readable, and amazingly fast:\nin my tests it was about 20% faster than the well known `khash`.\n\nnsz made another hashtable library called [genht](http://repo.hu/projects/genht),\nbut unfortunately it lacks decent documentation, consists of multiple files,\nand the latest sources are only available via a svn checkout.\ni have no doubts though that it is of highest quality too.\n\n-------------------------------------------------------------------------------\n\nthis hash table implementation is currently hardwired to be used with string\nkeys. it would be trivial to support other types too, but the more generic,\nthe more messy the API becomes.\n\nsee test.c for usage examples.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fhtab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofl0r%2Fhtab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fhtab/lists"}