{"id":16210293,"url":"https://github.com/johannesdeml/serializationbenchmarkdotnet","last_synced_at":"2025-03-19T09:30:32.640Z","repository":{"id":76786792,"uuid":"364001993","full_name":"JohannesDeml/SerializationBenchmarkDotNet","owner":"JohannesDeml","description":"dotnet benchmark for serialization and deserialization times and serialization sizes (.NET and Unity compatible libraries)","archived":false,"fork":false,"pushed_at":"2023-05-14T20:45:51.000Z","size":8898,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T17:24:49.801Z","etag":null,"topics":["benchmark","bitpacking","deserialization","dotnet","hacktoberfest","measurements","messagepack","protobuf","resource","serialization","serialization-library","statistics","unity"],"latest_commit_sha":null,"homepage":"","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/JohannesDeml.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}},"created_at":"2021-05-03T17:03:33.000Z","updated_at":"2024-08-08T03:02:33.000Z","dependencies_parsed_at":"2023-12-26T05:43:08.073Z","dependency_job_id":null,"html_url":"https://github.com/JohannesDeml/SerializationBenchmarkDotNet","commit_stats":{"total_commits":84,"total_committers":1,"mean_commits":84.0,"dds":0.0,"last_synced_commit":"3017c72ad26ca3f6a23000fd42d3a0db89eabd59"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohannesDeml%2FSerializationBenchmarkDotNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohannesDeml%2FSerializationBenchmarkDotNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohannesDeml%2FSerializationBenchmarkDotNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohannesDeml%2FSerializationBenchmarkDotNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohannesDeml","download_url":"https://codeload.github.com/JohannesDeml/SerializationBenchmarkDotNet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243980064,"owners_count":20378325,"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","bitpacking","deserialization","dotnet","hacktoberfest","measurements","messagepack","protobuf","resource","serialization","serialization-library","statistics","unity"],"created_at":"2024-10-10T10:36:49.423Z","updated_at":"2025-03-19T09:30:31.158Z","avatar_url":"https://github.com/JohannesDeml.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serialization Benchmark .NET\n\n*Benchmark for different serialization libraries for .NET 6*\n\n![Screenshot](./Docs/screenshot.png)\n\n[![Releases](https://img.shields.io/github/release/JohannesDeml/SerializationBenchmarkDotNet/all.svg)](../../releases) [![.NET 6](https://img.shields.io/badge/.NET-6-blueviolet.svg)](https://dotnet.microsoft.com/download/dotnet/6.0)\n\n## Description\n\nThis benchmark compares serialization times, deserialization times and serialization size of different libraries. The benchmark aims to be easily extensible for other serialization targets, while painting an objective picture of the most common serializers for .NET. Additionally, it also compares serializers against manual serialization.\n\n## Libraries\n\n* Manual Serialization with [BitPackingTools](https://github.com/emotitron/BitpackingTools)\n* [Protobuf](https://github.com/protocolbuffers/protobuf) (v23.0)\n* [MessagePack-CSharp](https://github.com/neuecc/MessagePack-CSharp) (v2.5.108)\n* [NetSerializer](https://github.com/tomba/netserializer) (v4.1.2)\n* [FlatBuffers](https://github.com/google/flatbuffers) (v23.5.9 - master [14725d6](https://github.com/google/flatbuffers/commit/72b56fd0810c9a6cd38ea1c8f40feaa1bb4916b1))\n* [Protobuf-Net](https://github.com/protobuf-net/protobuf-net) (v3.2.16)\n* [MsgPack-CLI](https://github.com/msgpack/msgpack-cli) (v1.0.1)\n* [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) (v13.0.3)\n* [Utf8Json](https://github.com/neuecc/Utf8Json) (v1.3.7)\n\n## Benchmarks\n\n![Overview](./Docs/sbn-overview-1.0.1-2-rows.png)\nThe benchmarks were run with three different setups. The results are shown in the charts above. Newtonsoft.Json was removed from this results, since it takes significantly more time for serialization and deserialization and would have made the chart hard to read.\n\n### Hardware\n\n* Ubuntu VPS\n  * Virtual private server with dedicated CPU's running - [Hardware](https://www.netcup.eu/bestellen/produkt.php?produkt=2624)\n  * Ubuntu 20.04.3 LTS x86-64 Kernel 5.14.0-051400-generic\n\n* Ubuntu Desktop / Windows Desktop\n  * Desktop PC from 2020 - [Hardware](https://pcpartpicker.com/user/JohannesDeml/saved/zz7yK8)\n  * Windows 10 Pro x86-64 Build 19043.1266 (21H1/May2021Update)\n  * Ubuntu 20.04.3 LTS x86-64 Kernel 5.11.0-37-generic\n\n### Software\n\n* [.NET](https://dotnet.microsoft.com/download/dotnet) 5.0.11 (5.0.1121.47308)\n* [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) 0.13.1\n\n### Targets\n* Person: Class with 2 variable length strings, one byte for age and enum Sex with three values\n* Vector 3: Struct with 3 floats\n\n### Results\nHere are the results from the 5 most promising libraries. All other results can be seen in the overview chart above or can be analyzed in the raw results from the release section. The results presented here are from the Ubuntu VPS setup. The results are cleaned by substracting the retrieved benchmark overhead.  \n\nYou can find the raw data of the results in the [release section](../../releases).\n\nThe benchmarks are generated with [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet). The results are generated from version 1.0.0\n\n``` ini\nBenchmarkDotNet=v0.12.1, OS=ubuntu 20.04\nAMD EPYC 7702P, 1 CPU, 4 logical and 4 physical cores\n.NET Core SDK=5.0.202\n  [Host]     : .NET Core 5.0.5 (CoreCLR 5.0.521.16609, CoreFX 5.0.521.16609), X64 RyuJIT\n  Job-TIPVXW : .NET Core 5.0.5 (CoreCLR 5.0.521.16609, CoreFX 5.0.521.16609), X64 RyuJIT\n\nPlatform=X64  Runtime=.NET Core 5.0  Concurrent=True  \nForce=False  Server=True  IterationTime=250.0000 ms  \nMaxIterationCount=20  MinIterationCount=15  UnrollFactor=8  \nWarmupCount=3  Version=1.0.0  OS=Linux 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021  \nDateTime=04/30/2021 11:07:23  SystemTag=Ubuntu VPS  \n```\n\n#### Serialization\n![Serialization duration](./Docs/sbn-serialize-1.0.1.png)\n#### Deserialization\n![Overview](./Docs/sbn-deserialize-1.0.1.png)\n#### Serialization Size\n![Overview](./Docs/sbn-datasize-1.0.1.png)\n\n### Reproduce\n\nMake sure you have [.Net 6 SDK](https://dotnet.microsoft.com/download) installed.  \n\nYou can reproduce the results by running `linux-benchmark.sh` on Linux or `win-benchmark.bat` on Windows. The benchmarks will take about 5 minutes to complete.\n\n## Contribute\n\nDo you think a Serializer is missing or want to add a different serialization target? Let's evolve this benchmark together! Either hit me up via [E-mail](mailto:public@deml.io) to discuss your idea, or [open an issue](../../issues), or make a pull request directly. There are a few rules in order to not make the benchmark too cluttered.\n\n### Adding a Library\n\nMake sure your library is either popular or can compete with the serialization seed of the selected libraries. The library also needs to be .NET5 compatible and should be interesting for others.\n\nIf your library is available through nuget, add it to the main project through nuget. Otherwise, add a new project and either include a https submodule, or a copy of the repo with a note, which commit was used.\n\nImplement the Serialize logic in the class `./SerializationBenchmarkDotNet/Serializer/YourSerializationLibraryName.cs`. This class should either inherit from `ADirectSerializer` if it uses the `Person.cs` and `Vector3.cs` directly, or `ASerializer` if it creates another format it deserializes to. Take a look at the other serializers to get an idea on how to implement your library.\n\nTo test your library, just add it to the list of Serializers in `SerializationBenchmark.cs`. You can debug your serializer by switching to the debug setting. This way, the benchmark will be run in the same process and only once per combination. Make sure your serializer manages to serialize and deserialize all targets and returns the correct serialization sizes.\n\n### Adding a Target\n\nThe new target should create interesting results. Either, it shows that a library is better at something that another thing, or it covers a space which is currently not covered by the existing targets.\n\nImplement the target class in `./SerializationBenchmarkDotNet/SerializationTargets/YourTarget.cs`. The class has to implement `IEquatable\u003cPerson\u003e, ISerializationTarget`.  To test your library, just add it to the list of Targets in `SerializationBenchmark.cs`. Make sure, all serializers can handle your new target. You will need to add custom code apart from attributes for some libraries (Manual serialization, FlatBuffers, Protobuf).\n\nYou can debug your serializer by switching to the debug setting. This way, the benchmark will be run in the same process and only once per combination. Make sure, each library generates serialization and deserialization times. If a library creates wrong results, it will throw an error and therefore no time will be generated.\n\n## License\n\n[MIT](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohannesdeml%2Fserializationbenchmarkdotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohannesdeml%2Fserializationbenchmarkdotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohannesdeml%2Fserializationbenchmarkdotnet/lists"}