Skip to content
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

C# Serialization Performance - Part I #5809

Closed
WilliamWhispell opened this issue Mar 3, 2019 · 2 comments · Fixed by #5810
Closed

C# Serialization Performance - Part I #5809

WilliamWhispell opened this issue Mar 3, 2019 · 2 comments · Fixed by #5810
Assignees
Labels

Comments

@WilliamWhispell
Copy link
Contributor

WilliamWhispell commented Mar 3, 2019

What version of protobuf and what language are you using?
Version: master
Language: C#

What operating system (Linux, Windows, ...) and version?
Linux, Windows

What runtime / compiler are you using (e.g., python version or gcc version)
MSBUILD 15

bool, double and float should be marked as fixed size. In FieldCodec.cs we create the codecs used by RepeatedField.cs. Having these not be fixed means that on large repeated fields for these fixed length primitives, we will call the size calculator each time, for every single data point (inside CalculatePackedDataSize). I've seen about 40% serialization improvement on repeated fields for these types when they are marked as fixed.

Straight forward fix is to rename ComputeBoolSize to ComputeFixedBoolSize, ComputeFloatSize to ComputeFixedFloatSize and ComputeDoubleSize to ComputeFixedDoubleSize, then we should change ForBool, ForFloat and ForDouble to send in a dummy value to the computesize functions when creating the codec (we will set the FixedSize attribute to the result).

@jtattermusch
Copy link
Contributor

@WilliamWhispell FTR, you might want to look at the ongoing planning for protobuf performance optimization in grpc/grpc-dotnet#30.

@WilliamWhispell
Copy link
Contributor Author

@jtattermusch - Had a quick read through. Sounds exciting. I looked over the pull request for the benchmark code the other day and I'm looking forward to its release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants