-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Protobuf-net Performance #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Any version information here, for context? Or better: the actual code? I am
indeed overdue another optimization pass, but hard to comment beyond that
without seeing them.
…On Mon, 4 Jan 2021, 21:33 Ravi Gupta, ***@***.***> wrote:
I was doing some benchmarking to compare the performance of Protobuf-net
with Google.Protobuf and MessagePack serializers and noticed that both
Google.Protobuf and MessagePack are significantly faster specially in case
of serialization time than Protobuf-net.
I was wondering whether its due any limitation with the code first nature
of Protobuf-net or its just matter of code optimization?
Benchmarking Code:
https://github.com/geeknoid/SerializationBenchmark
Here's the result of a benchmark that compares various serialization
options.
- The *Compressed versions uses MessagePack's built-in LZ4 compression.
- The *Pickled versions use an external LZ4 compression library.
- The *Plain versions are just the serializer proper, using efficient
buffer management to avoid allocs.
- ProtobufNet_* versions uses the Protobuf-net library.
- Protobuf_* version uses the Google.Protobuf library.
Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
MessagePack_SerializePlain 292.1 ms 5.40 ms 6.21 ms 2000.0000 - - 9.61 MB
MessagePack_SerializeCompressed 492.8 ms 7.35 ms 10.06 ms 2000.0000 - - 9.61
MB
MessagePack_SerializePickled 751.7 ms 14.62 ms 29.87 ms 19000.0000 - - 76.52
MB
ProtobufNet_SerializePlain 1,056.8 ms 19.53 ms 19.19 ms 11000.0000 - - 44.25
MB
ProtobufNet_SerializePickled 1,641.1 ms 30.66 ms 28.67 ms 28000.0000 - - 114.67
MB
Protobuf_SerializePlain 484.8 ms 6.40 ms 5.67 ms 3000.0000 - - 13.73 MB
Protobuf_SerializePickled 966.9 ms 17.26 ms 26.87 ms 20000.0000 - - 82.4
MB
SystemTextJson_SerializePlain 803.1 ms 15.89 ms 28.24 ms 56000.0000 - - 226.82
MB
SystemTextJson_SerializePickled 1,417.1 ms 18.51 ms 15.45 ms 24000.0000 -
- 99.49 MB
Newtonsoft_SerializePlain 1,718.5 ms 33.79 ms 54.56 ms 285000.0000 - - 1153.03
MB
Newtonsoft_SerializePickled 2,288.0 ms 25.30 ms 21.13 ms 307000.0000
43000.0000 - 1232.83 MB
MessagePack_DeserializePlain 586.0 ms 11.58 ms 11.89 ms 113000.0000
2000.0000 - 452.13 MB
MessagePack_DeserializeCompressed 620.9 ms 12.37 ms 20.32 ms 113000.0000
2000.0000 - 452.12 MB
MessagePack_DeserializePickled 705.9 ms 19.34 ms 52.60 ms 139000.0000
20000.0000 - 557.4 MB
ProtobufNet_DeserializePlain 771.3 ms 12.71 ms 18.23 ms 121000.0000 - - 482.79
MB
ProtobufNet_DeserializePickled 845.0 ms 14.73 ms 13.06 ms 148000.0000
4000.0000 - 593.8 MB
Protobuf_DeserializePlain 545.1 ms 7.08 ms 5.91 ms 129000.0000 1000.0000 - 518.34
MB
Protobuf_DeserializePickled 743.8 ms 28.11 ms 82.01 ms 154000.0000
22000.0000 - 617.75 MB
SystemTextJson_DeserializePlain 1,882.1 ms 27.80 ms 21.70 ms 125000.0000
16000.0000 - 498.96 MB
SystemTextJson_DeserializePickled 2,075.7 ms 43.62 ms 122.31 ms
176000.0000 1000.0000 - 706.18 MB
Newtonsoft_DeserializePlain 3,098.0 ms 60.45 ms 97.61 ms 255000.0000
54000.0000 - 1021.27 MB
Newtonsoft_DeserializePickled 3,301.8 ms 65.39 ms 114.53 ms 307000.0000
38000.0000 - 1228.71 MB
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#754>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMDX5ZJ6MDV4RLLHZ7TSYIX2RANCNFSM4VTTK47Q>
.
|
@mgravell there is a link to the benchmark code in the original post. Anyway here it is: |
Hey @mgravell, did you get a chance to look at the code I shared? Is there anything I missed which I should do to improve performance of protobuf-net? |
I haven't had chance to look. Still catching up on Xmas backlog, plus: all
the distractions that come from whatever crazy world we're currently in.
…On Sat, 9 Jan 2021, 20:07 Ravi Gupta, ***@***.***> wrote:
Hey @mgravell <https://github.com/mgravell>, did you get a chance to look
at the code I shared? Is there anything I missed which I should do to
improve performance of protobuf-net?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#754 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMHQKW3UX7WF5MQN7H3SZCZQPANCNFSM4VTTK47Q>
.
|
Here are the results :
Results are not good for protobuf-net :( |
maybe we can use source generator |
Tried to update the packages and run benchmarks for .NET 7 & .NET 8. Results:
|
I know what we need to do about this, and an experiment has been started with great results - it just needs a pile of my time, and right now my focus is Dapper/AOT. A lot of the learnings are shared, note - lots of generators goodness on the horizon. |
Any updates on this? |
I was doing some benchmarking to compare the performance of Protobuf-net with Google.Protobuf and MessagePack serializers and noticed that both Google.Protobuf and MessagePack are significantly faster specially in case of serialization time than Protobuf-net.
I was wondering whether its due any limitation with the code first nature of Protobuf-net or its just matter of code optimization?
Benchmarking Code:
https://github.com/geeknoid/SerializationBenchmark
Here's the result of a benchmark that compares various serialization options.
The text was updated successfully, but these errors were encountered: