{"id":19645581,"url":"https://github.com/michaco/serializationbenchmarks","last_synced_at":"2025-07-03T09:32:44.419Z","repository":{"id":77182396,"uuid":"94621175","full_name":"MichaCo/SerializationBenchmarks","owner":"MichaCo","description":null,"archived":false,"fork":false,"pushed_at":"2017-06-21T13:09:25.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T20:50:56.816Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MichaCo.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-06-17T12:03:25.000Z","updated_at":"2019-02-11T09:33:20.000Z","dependencies_parsed_at":"2023-02-26T10:30:18.636Z","dependency_job_id":null,"html_url":"https://github.com/MichaCo/SerializationBenchmarks","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/MichaCo%2FSerializationBenchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaCo%2FSerializationBenchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaCo%2FSerializationBenchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaCo%2FSerializationBenchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MichaCo","download_url":"https://codeload.github.com/MichaCo/SerializationBenchmarks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240952983,"owners_count":19884020,"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-11T14:34:33.914Z","updated_at":"2025-02-26T23:44:32.876Z","avatar_url":"https://github.com/MichaCo.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Benchmarks to Compare Different Serializers\n\nThe following serializer libraries are benchmarked:\n\n* Protobuf-net https://github.com/mgravell/protobuf-net\n* Newtonsoft.Json https://github.com/JamesNK/Newtonsoft.Json\n* Bond https://github.com/Microsoft/bond\n\n## Results\n\nSee [BenchmarkDotNet.Artifacts/results](https://github.com/MichaCo/SerializationBenchmarks/tree/master/src/BenchmarkRunner/BenchmarkDotNet.Artifacts/results)\n\n## Benchmarks\n\n### 1. Collection of Strings\nA simple collection of random strings (using `Guid.NewGuid.ToString()` n-times).\n\nThere are three benchmarks, one for a small collection (100 items), medium (1000 items) and large (10000 items).\n\n#### Results\n\n* [Large Collection](https://github.com/MichaCo/SerializationBenchmarks/blob/master/src/BenchmarkRunner/BenchmarkDotNet.Artifacts/results/LargeStringCollection-report-github.md)\n* [Medium Collection](https://github.com/MichaCo/SerializationBenchmarks/blob/master/src/BenchmarkRunner/BenchmarkDotNet.Artifacts/results/MediumStringCollection-report-github.md)\n* [Small Collection](https://github.com/MichaCo/SerializationBenchmarks/blob/master/src/BenchmarkRunner/BenchmarkDotNet.Artifacts/results/SmallStringCollection-report-github.md)\n\n#### Ranking\n\n1. Bond\n2. Protobuf-net\n3. Json\n4. Json + GZ compression - ofc this is slower, GZ compression could be applied to all of the tests. To see the effect in general I think one time is enough.\n\nInterestingly, Bond is slightly faster AND produces slightly smaller output then protobuf-net. Fast/Compact Bond seems not to make a big difference for this use-case.\n\n### 2. Simple Poco\nTesting a simple Poco with a few properties. Each benchmark run uses one object instance (400-500bytes).\n\n#### Results\n\n* [Simple Poco results](https://github.com/MichaCo/SerializationBenchmarks/blob/master/src/BenchmarkRunner/BenchmarkDotNet.Artifacts/results/SimplePoco-report-github.md)\n\n#### Rankings\n\n1. Fast Bond\n2. Compact Bond\n3. Protobuf-net\n4. Json\n\n* In this benchmark, there is a noticeable difference between fast (10% faster) and compact (2-3% smaller) bond in terms of performance and size.\n* Fun fact, the size of gz compressed Json is only marginally smaller than Bond/Protobuf but 22+ times slower\n\n---\n\nOther tests TBD\n\n* e.g. complex POCO with nested collections of POCOs...\n\n## Implementation Details\n\nI'm not 100% sure how to optimize the JSON and protobuf-net implementation as much as possible. \n\nFor Bond, pooling the `OutputBuffer` is key to improve performance by ~10-20%. Without pooling the buffer, protobuf-net will be faster!\n\nI'm also pooling the `MemoryStream` for all other implementations, the performance gain is a lot less though.\n\n@Marc, any other things which could be improved?","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaco%2Fserializationbenchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaco%2Fserializationbenchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaco%2Fserializationbenchmarks/lists"}