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
Proto3 experimental C# fork #515
Proto3 experimental C# fork #515
Conversation
…, it's pretty slow right now.
Cache a reference to Encoding.UTF8 - the property access is (rather surprisingly) significant. Additionally, when we detect that the string is all ASCII (due to the computed length in bytes being the length in characters), we can perform the encoding very efficiently ourselves.
… a single byte. Aside from anything else, this will be used for all tags for fields 1-15.
This makes repeated fields really awkward at the moment - but when we reimplement RepeatedField<T> to be backed by an array, we can cast the array directly...
Remove ICodedInputStream and ICodedOutputStream, and rewrite CodedInputStream and CodedOutputStream to be specific to the binary format. If we want to support text-based formats, that can be a whole different serialization mechanism.
This mirrors commit 7c86bbb in the pull request to the main protobuf project, but also reduces the size of the buffer created. (There's no point in creating a 1024-byte buffer if we're only skipping 5 bytes...)
…han an equality check.
I wouldn't expect this to affect anything, but it appears to.
This is effectively reimplementing List<T>, but with a few advantages: - We know that an empty repeated field is common, so don't allocate an array until we need to - With direct access to the array, we can easily convert enum values to int without boxing - We can relax the restrictions over what happens if the repeated field is modified while iterating, avoiding so much checking This is somewhat risky, in that reimplementing a building block like this is *always* risky, but hey... (The performance benefits are significant...)
… - files to be killed later.
We'll probably want a lot of the code from the serialization project when we do JSON, but enough of it will change that it's not worth keeping in a broken state for now.
- Make some members internal - Remove a lot of FrameworkPortability that isn't required - Start adding documentation comments - Remove some more group-based members - Not passing in "the last tag read" into Read*Array, g
One note to be aware of - this branch contains a change to wire_format.h that we may not want. See |
@jtattermusch @anandolee to review and merge. |
I went quickly through the changes commit-by-commit because it's too big to display at once. It looks good to me (for what we need right now), let's merge this so we allow contributions from others. I've tried to identify changes that are potentially dangerous and that should be reviewed separately (as a second pass once we merge this - I am happy to create bugs for these): "array as backing store" "improve string encoding times" "inlining tag sizes" Also some nits: Perhaps we could rename RepeatedField to something else in the future. |
Merging this with @anandolee 's consent. |
Proto3 experimental C# fork
When --go_out=paths=source_relative:., output filenames are always derived from the input filenames. For example, the output file for a/b/c.proto will always be a/b/c.pb.go, regardless of the presence or absence of a go_package option in the input file. Fixes protocolbuffers#515.
force explicit conversions to desired types in generated code
More to do, but this will allow others to contribute more easily...