{"id":16110039,"url":"https://github.com/qchateau/cbitstruct","last_synced_at":"2025-04-02T17:01:41.332Z","repository":{"id":57416998,"uuid":"208494549","full_name":"qchateau/cbitstruct","owner":"qchateau","description":"Faster C implementation of the bitstruct Python library","archived":false,"fork":false,"pushed_at":"2024-09-30T21:29:58.000Z","size":81,"stargazers_count":22,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T04:18:48.585Z","etag":null,"topics":["bit","bitfield","bitstruct","c","fast","packing","python","unpacking"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qchateau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-09-14T19:43:23.000Z","updated_at":"2025-03-21T13:02:37.000Z","dependencies_parsed_at":"2024-06-21T12:59:22.012Z","dependency_job_id":"2427eedd-c47f-4f67-ac3b-c1610ceea0e5","html_url":"https://github.com/qchateau/cbitstruct","commit_stats":{"total_commits":29,"total_committers":4,"mean_commits":7.25,"dds":0.2068965517241379,"last_synced_commit":"61036095169cbdeddaedf91a3d08b6db1ec069c2"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qchateau%2Fcbitstruct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qchateau%2Fcbitstruct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qchateau%2Fcbitstruct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qchateau%2Fcbitstruct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qchateau","download_url":"https://codeload.github.com/qchateau/cbitstruct/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246847137,"owners_count":20843444,"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":["bit","bitfield","bitstruct","c","fast","packing","python","unpacking"],"created_at":"2024-10-09T19:35:18.387Z","updated_at":"2025-04-02T17:01:41.274Z","avatar_url":"https://github.com/qchateau.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![License](https://img.shields.io/badge/license-MPL--2.0-brightgreen)  [![Build Status](https://travis-ci.com/qchateau/cbitstruct.svg?branch=master)](https://travis-ci.com/qchateau/cbitstruct)\n\n# About\n\n`cbitstruct` is a C implementation of the `bitstruct` library. Credits to Erik Moqvist for the original `bitstruct` library available on [Github](https://github.com/eerimoq/bitstruct) and [pip](https://pypi.org/project/bitstruct/).\n\nThe goal is to provide the same API an idealy to be able to interchange `import bitstruct` and `import cbitstruct as bitstruct`.\n\nObvious increased performance comes with limitations described below.\n\n# Installation\n\n```bash\npip3 install cbitstruct\n```\n\n# Documentation\n\nPlease refer to the [`bitstruct` documentation](https://bitstruct.readthedocs.io/en/latest/) as the aim of this library is to provide the same API with increased performance.\n\nIf you are not used to `bitstruct`, you should seriously consider using it first, before migrating to this library if you require higher performance.\n\n# Limitations\n\n| Limitation | Will it be lifted ? |\n|------------|---------------------|\n| All types except padding are limited to 64 bits | Maybe for 'raw' and 'text' types |\n| May not work on big-endian architectures | Maybe |\n| Exceptions differ from `bitstruct` | Probably not |\n| CPython only | Probably not |\n| Error messages are unclear | Will never be as clear as `bitstruct` |\n| Python \u003e= 3.5 | No |\n\nSome limitations are there because I did not get the time or motivation to lift them up. Some other are deeply rooted into this library and may never be lifted.\n\n# Performance\n\n## Comparing to `bitstruct`\n\nThe script available in `tests/test_perf.py` measures performance comparing to the `bitstruct` library.\n\nHere are the result \"on my machine\" (Ubuntu in Virtualbox on a laptop):\n```\nbyteswap list of int      | x  8.779 (   8.638us -\u003e   0.984us)\nbyteswap str              | x 17.466 (   9.158us -\u003e   0.524us)\ncalcsize                  | x139.330 (  61.060us -\u003e   0.438us)\ncompiled pack             | x 47.389 (  35.968us -\u003e   0.759us)\ncompiled pack_dict        | x 27.184 (  34.588us -\u003e   1.272us)\ncompiled pack_into        | x 32.037 (  38.650us -\u003e   1.206us)\ncompiled pack_into_dict   | x 27.343 (  37.718us -\u003e   1.379us)\ncompiled unpack           | x 33.928 (  31.278us -\u003e   0.922us)\ncompiled unpack_dict      | x 21.627 (  31.597us -\u003e   1.461us)\ncompiled unpack_from      | x 30.622 (  29.977us -\u003e   0.979us)\ncompiled unpack_from_dict | x 20.479 (  30.936us -\u003e   1.511us)\npack                      | x 77.003 ( 103.030us -\u003e   1.338us)\npack_dict                 | x 53.254 ( 103.255us -\u003e   1.939us)\npack_into                 | x 82.829 ( 119.373us -\u003e   1.441us)\npack_into_dict            | x 52.173 ( 108.135us -\u003e   2.073us)\nunpack                    | x 78.459 (  91.896us -\u003e   1.171us)\nunpack_dict               | x 40.287 (  89.300us -\u003e   2.217us)\nunpack_from               | x 77.027 (  91.202us -\u003e   1.184us)\nunpack_from_dict          | x 39.467 (  88.043us -\u003e   2.231us)\n```\n\n*Disclaimer:* these results may and will vary largely depending on the number of elements and types you pack/unpack. This script is provided as-is, and I will gladly accept an improved script providing more reliable results.\n\n\n## The dict API\nThe `dict` API is marginally slower than the traditional one. As the packing/unpacking performance is quite high, the overhead of performing dictionary lookups and hashing significantly increas pack and unpacking duration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqchateau%2Fcbitstruct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqchateau%2Fcbitstruct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqchateau%2Fcbitstruct/lists"}