{"id":21989182,"url":"https://github.com/repcomm/dynobj","last_synced_at":"2025-03-23T02:45:17.610Z","repository":{"id":130854101,"uuid":"340127267","full_name":"RepComm/dynobj","owner":"RepComm","description":"Dynamic objects for C","archived":false,"fork":false,"pushed_at":"2021-03-15T05:49:06.000Z","size":103,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T08:51:40.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/RepComm.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-18T17:33:53.000Z","updated_at":"2021-03-15T05:49:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"c80d5889-3642-41dd-b4d9-db76060948b5","html_url":"https://github.com/RepComm/dynobj","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/RepComm%2Fdynobj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fdynobj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fdynobj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fdynobj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RepComm","download_url":"https://codeload.github.com/RepComm/dynobj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245048276,"owners_count":20552483,"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":[],"created_at":"2024-11-29T19:28:15.384Z","updated_at":"2025-03-23T02:45:17.582Z","avatar_url":"https://github.com/RepComm.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynobj\n\nA dynamic object library written in C\n\n## Dependencies\n- stdlib.h [malloc]\n- [jwerle/murmurhash](https://github.com/jwerle/murmurhash.c) [soft dependency]\n\n---\n\nEventually, all dependencies will be soft dependencies (ones that can be swapped at will)\n\n---\n\nHashedKeyStore now is completely free from hash implementation, and only requires\npassing a callback that takes `char *` and returns `int`\n\nImplementation that uses murmurhash is in dynobj.c\n\n## What\nHeap allocated objects/properties for C\n\nObjects are fancy linked-lists of key-value pairs\n\nKey value pairs here are actually fixed size (hash, void-pointer) structs\n\n`object-\u003eget` is more expensive than `object-\u003egetByHash`\n\nas `get` has to reverse lookup the hash from the key\n\n## Performance\nI have not run tests yet, but this should be pretty darn fast\nNothing is as fast as static and fixed data structures, though\n\n## Caching and optimisations\nA frequent requirement is to have the count of properties of an object\u003cbr/\u003e\nThis value is cached and marked dirty when the object-\u003eset method is called\n\nObject keys are stored as hashes (32bit atm) to save space\u003cbr/\u003e\nand to make object memory more predictable/safe\n\nIf two objects both have a key `\"some really really really really long string\"` there will only be one copy of that string stored in the HashedKeyTable globally.\u003cbr/\u003e\n\nThis can save a lot of space with lots of similar objects.\n\n---\nA future optimisation will be sorting HashedKeyStore linked list for binary search during reverse lookup\n\n## Why\nI'm new to C, and like a good challenge\n\nDynamic objects are great for rapid prototyping\n\n## State\nFunctional, needs testing before production ready\n\n## API\n\nStandalone functions\n- DynObj_create\n- DynObj_set\n- DynObj_get\n- DynObj_getByHash\n\nObject instance methods\n- obj-\u003eset (same as DynObj_set)\n- obj-\u003eget (same as DynObj_get)\n- obj-\u003egetByHash (same as DynObj_getByHash)\n\n### Note:\n\nC doesn't have a concept of `this`,\u003cbr/\u003e\nso object methods must be passed a reference to itself\nin the first parameter.\u003cbr/\u003e\n\nI know this can feel weird for non C programmers, but its not a real hinderence as you need a reference to the object in question anyways.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepcomm%2Fdynobj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frepcomm%2Fdynobj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepcomm%2Fdynobj/lists"}