Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c3171b5
perf(MemoryStreamReader.cs): Removed unnecessary memory allocation an…
RelaxSpirit Dec 29, 2025
515ae12
Merge branch 'main' into imp_proc_speed
RelaxSpirit Dec 29, 2025
d9ad76b
Update MemoryStreamReader.cs
RelaxSpirit Dec 31, 2025
6754763
fix(Fixed a typo in the method name 'GetMassagePackObjectTokens')
RelaxSpirit Jan 11, 2026
87de9df
Merge branch 'nanoframework:main' into imp_proc_speed
RelaxSpirit Jan 14, 2026
0284239
perf(Direct comparison of types when searching for converters);
RelaxSpirit Feb 3, 2026
a502e15
perf(Add new Unit test for inherited classes)
RelaxSpirit Feb 3, 2026
ad25892
perf(Added new type compare benchmark);
RelaxSpirit Feb 3, 2026
28bec6a
docs(Updated with benchmark results)
RelaxSpirit Feb 3, 2026
fa0390c
Merge branch 'imp_proc_speed' of https://github.com/RelaxSpirit/nanoF…
RelaxSpirit Feb 3, 2026
76af96c
Update Shared/MessagePack/Converters/UshortConverter.cs
josesimoes Feb 18, 2026
2cd5482
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
7dd0646
Update Program.cs
RelaxSpirit Feb 18, 2026
c36a8b7
Update UlongConverter.cs
RelaxSpirit Feb 18, 2026
c2887fe
Update TypeCompareBenchmark.cs
RelaxSpirit Feb 18, 2026
880dd4d
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
0905038
Update DoubleConverter.cs
RelaxSpirit Feb 18, 2026
dd2a663
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
50dcfe0
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
4e2b8dc
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
e6cddbb
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
11f0b70
Update MemberMapping.cs
RelaxSpirit Feb 18, 2026
78be46a
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
8f627fe
Apply suggestion from @Copilot
RelaxSpirit Feb 18, 2026
6cefe1d
Update LongConverter.cs
RelaxSpirit Feb 18, 2026
ada1c02
Update CharConverter.cs
RelaxSpirit Feb 18, 2026
ac259b6
Update IntConverter.cs
RelaxSpirit Feb 18, 2026
201e716
Update ShortConverter.cs
RelaxSpirit Feb 18, 2026
102667f
Update TimeSpanConverter.cs
RelaxSpirit Feb 18, 2026
d16c20c
Update ArraySegment.cs
RelaxSpirit Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 129 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,40 +250,148 @@ After completing these steps, the serialization/deserialization of the object fo

## Benchmarks

The measurements were carried out on the developer's local computer in a virtual nanoDevice:
Comparing data:
```json
{
"StartDate": "2026-01-27T00:00:00.0000000Z",
"WorkingTime": "00:02:00",
"TestObjects": [
{
"UID": "e8048178-b787-4f22-85bc-891b6637d353",
"Id": 1
},
{
"UID": "41B07FC4-AE08-4F9B-B9A7-27E8877708D2",
"Id": 2
}
],
"IntArrayData": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
"Users": [
{
"Role": {
"Name": "Admin",
"Id": 1
},
"IsActive": true,
"Name": "Test"
}
],
"HashData": {
"a": "Test",
"b": 123
}
}
```

Size after serialization:

```text
===============================================================
========== Comparative benchmarks data ==========
========== ==========
========== Json string size: 3957 bytes ==========
========== BinaryFormatter array size: 1079 bytes ==========
========== MessagePack array size: 2444 bytes ==========
========== Json string size: 336 bytes ==========
========== MessagePack array size: 197 bytes ==========
========== BinaryFormatter array size: 186 bytes ==========
========== ==========
===============================================================
```

The measurements were carried out on the developer's local computer in a virtual nanoDevice:

```text
********** Starting benchmarks on Virtual nanoDevice **********

| ------------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| ------------------------------------------------------------------------------- |
| JsonDeserializationBenchmark | 5 | 94.8 ms | 83 ms | 112 ms |
| MessagePackDeserializationBenchmark | 5 | 49.4 ms | 48 ms | 51 ms |
| BinaryDeserializationBenchmark | 5 | 0.4 ms | 0 ms | 1 ms |
| ------------------------------------------------------------------------------- |

| ------------------------------------------------------------------------------------------ |
| MethodName | IterationCount | Mean | Min | Max |
| ------------------------------------------------------------------------------------------ |
| JsonSerializationBenchmark | 5 | 57 ms | 51 ms | 63 ms |
| MessagePackSerializationBenchmark | 5 | 41.399999999999997 ms | 40 ms | 44 ms |
| BinarySerializationBenchmark | 5 | 0.2 ms | 0 ms | 1 ms |
| ------------------------------------------------------------------------------------------ |
********** Completed benchmarks **********

*Remark:
One iteration is 20 consecutive repetitions!
```

Console export: ComparativeDeserializationBenchmark benchmark class.
Measurements taken on the ESP32 WROOM device:

| ------------------------------------------------------------------------------ |
| MethodName | IterationCount | Mean | Min | Max |
| ------------------------------------------------------------------------------ |
| JsonDeserializationBenchmark | 10 | 27.5 ms | 22 ms | 37 ms |
| BinaryDeserializationBenchmark | 10 | 0.1 ms | 0 ms | 1 ms |
| MessagePackDeserializationBenchmark | 10 | 23.7 ms | 19 ms | 34 ms |
| ------------------------------------------------------------------------------ |
```text
********** Starting benchmarks on ESP32_REV3 **********

| ------------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| ------------------------------------------------------------------------------- |
| JsonDeserializationBenchmark | 5 | 386 ms | 380 ms | 390 ms |
| MessagePackDeserializationBenchmark | 5 | 188 ms | 180 ms | 190 ms |
| BinaryDeserializationBenchmark | 5 | 4 ms | 0 ms | 10 ms |
| ------------------------------------------------------------------------------- |

| ----------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| ----------------------------------------------------------------------------- |
| JsonSerializationBenchmark | 5 | 226 ms | 220 ms | 230 ms |
| MessagePackSerializationBenchmark | 5 | 126 ms | 120 ms | 130 ms |
| BinarySerializationBenchmark | 5 | 2 ms | 0 ms | 10 ms |
| ----------------------------------------------------------------------------- |
********** Completed benchmarks **********
```

Console export: ComparativeSerializationBenchmark benchmark class.
Measurements taken on the XIAO-ESP32-C3 device:

```text
********** Starting benchmarks on XIAO_ESP32C3 **********

| ------------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| ------------------------------------------------------------------------------- |
| JsonDeserializationBenchmark | 5 | 208 ms | 200 ms | 210 ms |
| MessagePackDeserializationBenchmark | 5 | 98 ms | 90 ms | 100 ms |
| BinaryDeserializationBenchmark | 5 | 0 ms | 0 ms | 0 ms |
| ------------------------------------------------------------------------------- |

| ----------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| ----------------------------------------------------------------------------- |
| JsonSerializationBenchmark | 5 | 140 ms | 140 ms | 140 ms |
| MessagePackSerializationBenchmark | 5 | 80 ms | 80 ms | 80 ms |
| BinarySerializationBenchmark | 5 | 0 ms | 0 ms | 0 ms |
| ----------------------------------------------------------------------------- |
********** Completed benchmarks **********
```

| ---------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| ---------------------------------------------------------------------------- |
| JsonSerializationBenchmark | 10 | 18.9 ms | 16 ms | 25 ms |
| BinarySerializationBenchmark | 10 | 0.1 ms | 0 ms | 1 ms |
| MessagePackSerializationBenchmark | 10 | 9.8 ms | 9 ms | 14 ms |
| ---------------------------------------------------------------------------- |
Measurements taken on the XIAO-ESP32-C6 device:

```text
********** Starting benchmarks on ESP32_C6_THREAD **********

| ------------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| ------------------------------------------------------------------------------- |
| JsonDeserializationBenchmark | 5 | 112 ms | 110 ms | 120 ms |
| MessagePackDeserializationBenchmark | 5 | 60 ms | 60 ms | 60 ms |
| BinaryDeserializationBenchmark | 5 | 2 ms | 0 ms | 10 ms |
| ------------------------------------------------------------------------------- |

| -------------------------------------------------------------------------- |
| MethodName | IterationCount | Mean | Min | Max |
| -------------------------------------------------------------------------- |
| JsonSerializationBenchmark | 5 | 68 ms | 60 ms | 70 ms |
| MessagePackSerializationBenchmark | 5 | 48 ms | 40 ms | 50 ms |
| BinarySerializationBenchmark | 5 | 2 ms | 0 ms | 10 ms |
| -------------------------------------------------------------------------- |
********** Completed benchmarks **********
```
As it can be seen from the benchmark results above, in what concerns speed and compaction, `MessagePack` performs better than the Json serializer. Comming at no surprise, Binary serialization is the most performant one.

As it can be seen from the benchmark results above, in what concerns speed and compaction, `MessagePack` performs better than the Json serializer. Coming at no surprise, Binary serialization is the most performant one.

## Acknowledgements

Expand Down
Loading