{"id":16870839,"url":"https://github.com/nmaier/nmaier.serialization","last_synced_at":"2025-03-18T21:50:25.947Z","repository":{"id":138471590,"uuid":"80580762","full_name":"nmaier/NMaier.Serialization","owner":"nmaier","description":"A (somewhat more) efficient binary formatter","archived":false,"fork":false,"pushed_at":"2017-02-01T01:47:24.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T23:45:34.458Z","etag":null,"topics":["binary","binaryformat","serialization"],"latest_commit_sha":null,"homepage":null,"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/nmaier.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}},"created_at":"2017-02-01T01:47:16.000Z","updated_at":"2021-12-27T16:55:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7e9cf53-922d-4f7f-bca2-b06a20475ecc","html_url":"https://github.com/nmaier/NMaier.Serialization","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/nmaier%2FNMaier.Serialization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmaier%2FNMaier.Serialization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmaier%2FNMaier.Serialization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmaier%2FNMaier.Serialization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmaier","download_url":"https://codeload.github.com/nmaier/NMaier.Serialization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244313190,"owners_count":20433003,"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":["binary","binaryformat","serialization"],"created_at":"2024-10-13T15:05:33.905Z","updated_at":"2025-03-18T21:50:25.933Z","avatar_url":"https://github.com/nmaier.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A (somewhat more) efficient binary formatter  #\n\nBecause serialization is hard \n\n## Goals ##\n\n* Be compatible enough with built-in C# Serialization, while still being efficient enough in the CPU, memory and storage size departments\n\t* Serialize most things incl. `ISerializable`\n\t* Omit feature I do not need, in particular, surrugates, events\n* Provide an efficient (enough) binary representation that is still reliable (for persistence)\n\t* Use basic tags (`ElementType`) to mark in a stream what comes next\n\t* Provide specialized tags for things like `null`, PODs (including DateTime),  enums, different arrays (empty, byte, 1-item, rank-1, PODs, generic objects), etc.\n\t* Allow cycles and copies by writing an object only once and writing references to that afterwards\n\t* Avoid duplicate strings\n\t* Tune writing of (`unsigend`) lengths (inspired by websocket frames)\n\t\t* \u0026lt; 254 will use one byte\n\t\t* \u0026lt;= `ushort.MAXVALUE` will use three bytes (16-bit + one byte for the  tag (`0xfe`)\n\t\t* Otherwise use 5 bytes (32-bit + one byte for the tag (`0xff`))\n\t\t* Since most lengths written will be shortish, most will only use 1 byte instead of 4 bytes for an `int`.\n\t* Optimize assembly/type storage a bit (See also `EfficientSerializationBinder.RegisterKnown`)\n* Thread-safe, reusable `IFormatter` (allowing to specify the `StreamingContext` per `Serialize`/`Deserialize` call)\n\t* Make use of `Concurrent` for global caches\n* Be somewhat hackable (e.g. to add new optimized representations without breaking existing serialized representations)\n\n\n## Non-Goals ##\n\n* Be entirely compatible\n* Be secure (especially against tempering)\n* Be error-resilient/use advanced error detection (against stream errors)\n* Be memory efficient in the face of serializing tons of different object types (the caches are unlimited in growth by design)\n\n## State ##\n\n**Very** *alpha*! You have been warned!\n\n*Good enough* for caching stuff to disk (that is, you can regenerate things at any time)\n\nDo **not** use this over the network unless you bolt message authentication on top.\nOr else an attacker will literally delete all your stuff!\n\nProbably **not** a great idea to use this inter-application, either.\n\n## TODO ##\n\n- Optimize list types\n- Optimize dict types","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmaier%2Fnmaier.serialization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmaier%2Fnmaier.serialization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmaier%2Fnmaier.serialization/lists"}