{"id":13533734,"url":"https://github.com/felixguendling/cista","last_synced_at":"2025-05-14T07:08:26.132Z","repository":{"id":37565344,"uuid":"159045490","full_name":"felixguendling/cista","owner":"felixguendling","description":"Cista is a simple, high-performance, zero-copy C++ serialization \u0026 reflection library.","archived":false,"fork":false,"pushed_at":"2025-04-24T20:56:28.000Z","size":1026,"stargazers_count":1998,"open_issues_count":8,"forks_count":134,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-04-24T21:50:45.001Z","etag":null,"topics":["benchmark","cpp","cpp17","deserialization","efficient","high-performance","reflection","serialization","zero-copy"],"latest_commit_sha":null,"homepage":"https://cista.rocks","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felixguendling.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2018-11-25T15:22:06.000Z","updated_at":"2025-04-24T20:56:31.000Z","dependencies_parsed_at":"2023-02-14T23:01:03.730Z","dependency_job_id":"fe763123-e5a8-47c1-816d-07dd33589430","html_url":"https://github.com/felixguendling/cista","commit_stats":{"total_commits":604,"total_committers":20,"mean_commits":30.2,"dds":"0.17384105960264906","last_synced_commit":"eecb4bed2999f773f4a0933a225d4df6af22e466"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixguendling%2Fcista","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixguendling%2Fcista/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixguendling%2Fcista/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixguendling%2Fcista/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixguendling","download_url":"https://codeload.github.com/felixguendling/cista/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092776,"owners_count":22013290,"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":["benchmark","cpp","cpp17","deserialization","efficient","high-performance","reflection","serialization","zero-copy"],"created_at":"2024-08-01T07:01:22.599Z","updated_at":"2025-05-14T07:08:26.110Z","avatar_url":"https://github.com/felixguendling.png","language":"C++","funding_links":[],"categories":["Serialization","C++","Libraries"],"sub_categories":["Parsing \u0026 Serialization","C++"],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"logo.svg\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://isocpp.org/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/language-C%2B%2B17-blue.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/felixguendling/cista/actions?query=workflow%3A%22Linux+Build%22\"\u003e\n        \u003cimg src=\"https://github.com/felixguendling/cista/workflows/Linux%20Build/badge.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/felixguendling/cista/actions?query=workflow%3A%22Windows+Build%22\"\u003e\n        \u003cimg src=\"https://github.com/felixguendling/cista/workflows/Windows%20Build/badge.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\" \u003e\n        \u003cimg src=\"https://img.shields.io/github/license/felixguendling/cista\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n# Simple C++ Serialization \u0026 Reflection.\n\nCista++ is a simple, open source (MIT license) C++17 compatible way of (de-)serializing C++ data structures.\n\n*Single header - no dependencies. No macros. No source code generation.*\n\n  - Raw performance - use your native structs. Supports modification/resizing of deserialized data!\n  - Supports complex and cyclic data structures including cyclic references, recursive data structures, etc.\n  - Save 50% memory: serialize directly to the filesystem if needed, no intermediate buffer required.\n  - Fuzzing-checked though continuous fuzzing using LLVMs LibFuzzer.\n  - Comes with a serializable high-performance hash map and hash set implementation based on [Google's Swiss Table](https://abseil.io/blog/20180927-swisstables).\n  - Reduce boilerplate code: automatic derivation of hash and equality functions.\n  - Built-in optional automatic data structure versioning through recursive type hashing.\n  - Optional check sum to prevent deserialization of corrupt data.\n  - Compatible with Clang, GCC, and MSVC\n\nThe underlying reflection mechanism can be used in [other ways](https://cista.rocks/#reflection), too!\n\n**Examples:**\n\nDownload the [latest release](https://github.com/felixguendling/cista/releases/latest/download/cista.h) and try it out.\n\nSimple example writing to a buffer:\n\n```cpp\nnamespace data = cista::raw;\nstruct my_struct {  // Define your struct.\n  int a_{0};\n  struct inner {\n      data::string b_;\n  } j;\n};\n\nstd::vector\u003cunsigned char\u003e buf;\n{  // Serialize.\n  my_struct obj{1, {data::string{\"test\"}}};\n  buf = cista::serialize(obj);\n}\n\n// Deserialize.\nauto deserialized = cista::deserialize\u003cmy_struct\u003e(buf);\nassert(deserialized-\u003ej.b_ == data::string{\"test\"});\n```\n\nAdvanced example writing a hash map to a memory mapped file:\n\n```cpp\nnamespace data = cista::offset;\nconstexpr auto const MODE =  // opt. versioning + check sum\n    cista::mode::WITH_VERSION | cista::mode::WITH_INTEGRITY;\n\nstruct pos { int x, y; };\nusing pos_map =  // Automatic deduction of hash \u0026 equality\n    data::hash_map\u003cdata::vector\u003cpos\u003e,\n                   data::hash_set\u003cdata::string\u003e\u003e;\n\n{  // Serialize.\n  auto positions =\n      pos_map{{{{1, 2}, {3, 4}}, {\"hello\", \"cista\"}},\n              {{{5, 6}, {7, 8}}, {\"hello\", \"world\"}}};\n  cista::buf mmap{cista::mmap{\"data\"}};\n  cista::serialize\u003cMODE\u003e(mmap, positions);\n}\n\n// Deserialize.\nauto b = cista::mmap(\"data\", cista::mmap::protection::READ);\nauto positions = cista::deserialize\u003cpos_map, MODE\u003e(b);\n```\n\nAdvanced example showing support for non-aggregate types like derived classes or classes with custom constructors:\n\n```cpp\nnamespace data = cista::offset;\nconstexpr auto MODE = cista::mode::WITH_VERSION;\n\nstruct parent {\n  parent() = default;\n  explicit parent(int a) : x_{a}, y_{a} {}\n  auto cista_members() { return std::tie(x_, y_); }\n  int x_, y_;\n};\nstruct child : parent {\n  child() = default;\n  explicit child(int a) : parent{a}, z_{a} {}\n  auto cista_members() {\n    return std::tie(*static_cast\u003cparent*\u003e(this), z_);\n  }\n  int z_;\n};\n\n/*\n * Automatically defaulted for you:\n *   - de/serialization\n *   - hashing (use child in hash containers)\n *   - equality comparison\n *   - data structure version (\"type hash\")\n */\nusing t = data::hash_map\u003cchild, int\u003e;\n\n// ... usage, serialization as in the previous examples\n```\n\n# Benchmarks\n\nHave a look at the [benchmark repository](https://github.com/felixguendling/cpp-serialization-benchmark) for more details.\n\n| Library                                               | Serialize      | Deserialize     | Fast Deserialize |   Traverse | Deserialize \u0026 Traverse |      Size  |\n| :---                                                  |           ---: |            ---: |             ---: |       ---: |                   ---: |       ---: |\n| [Cap’n Proto](https://capnproto.org/capnp-tool.html)  |       105 ms   |    **0.002 ms** |       **0.0 ms** |   356 ms   |               353 ms   |    50.5M   |\n| [cereal](https://uscilab.github.io/cereal/index.html) |       239 ms   |    197.000 ms   |                - |   125 ms   |               322 ms   |    37.8M   |\n| [Cista++](https://cista.rocks/) `offset`              |      **72 ms** |      0.053 ms   |       **0.0 ms** |   132 ms   |             **132 ms** |  **25.3M** |\n| [Cista++](https://cista.rocks/) `raw`                 |      3555 ms   |     68.900 ms   |        21.5 ms   | **112 ms** |             **133 ms** |   176.4M   |\n| [Flatbuffers](https://google.github.io/flatbuffers/)  |      2349 ms   |     15.400 ms   |       **0.0 ms** |   136 ms   |             **133 ms** |    63.0M   |\n\n\n# Use Cases\n\nReader and writer should have the same pointer width. Loading data on systems with a different byte order (endianess) is supported.\nExamples:\n\n  - Asset loading for all kinds of applications (i.e. game assets, GIS data, large graphs, etc.)\n  - Transferring data over network\n  - shared memory applications\n\nCurrently, only C++17 software can read/write data.\nBut it should be possible to generate accessors\nfor other programming languages, too.\n\n# Alternatives\n\nIf you need to be compatible with other programming languages\nor require protocol evolution (downward compatibility)\nyou should look for another solution:\n\n  - [Protocol Buffers](https://developers.google.com/protocol-buffers/)\n  - [Cap’n Proto](https://capnproto.org/)\n  - [Flatbuffers](https://google.github.io/flatbuffers/)\n  - [cereal](https://uscilab.github.io/cereal/)\n  - [Boost Serialization](https://www.boost.org/doc/libs/1_68_0/libs/serialization/doc/index.html)\n  - [MessagePack](https://msgpack.org/)\n  - [tser](https://github.com/KonanM/tser)\n  - [... many more](https://en.wikipedia.org/wiki/Comparison_of_data_serialization_formats)\n\n# Documentation\n\n* [Installation and Usage](https://github.com/felixguendling/cista/wiki/Installation-and-Usage)\n* [Serialization Reference](https://github.com/felixguendling/cista/wiki/Serialization-Reference)\n* [Custom (De-)Serialization Functions](https://github.com/felixguendling/cista/wiki/Custom-(De-)Serialization-Functions)\n* [Data Structure Versioning](https://github.com/felixguendling/cista/wiki/Data-Structure-Versioning)\n* [Hash Containers](https://github.com/felixguendling/cista/wiki/Hash-Containers)\n  * [Hashing Framework](https://github.com/felixguendling/cista/wiki/Hashing-Framework)\n  * [Equality Framework](https://github.com/felixguendling/cista/wiki/Equality-Framework)\n  * [Benchmark](https://github.com/felixguendling/cista/wiki/Hash-Map-Benchmark)\n* [Security](https://github.com/felixguendling/cista/wiki/Security)\n\n# Contribute\n\nFeel free to contribute (bug reports, pull requests, etc.)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixguendling%2Fcista","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixguendling%2Fcista","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixguendling%2Fcista/lists"}