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

Merge C# proto3 from csharp-experimental to master #632

Merged
merged 161 commits into from Jul 30, 2015

Conversation

jtattermusch
Copy link
Contributor

I think we are now in a good shape to merge C# proto3 back into master. Most of the proto3 functionality has been implemented and we addressed the cleanup we wanted:

C# cleanup tasks:
https://github.com/google/protobuf/issues?q=is%3Aissue+milestone%3A%22C%23+code+cleanup%22+is%3Aclosed

jskeet and others added 30 commits June 5, 2015 20:44
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...)
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...)
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
Proto3 experimental C# fork
First attempt at using profile 259 for Google.Protobuf.
@jtattermusch
Copy link
Contributor Author

@anandolee @pherl I think we can proceed with this PR now (please see my e-mail).

@jtattermusch
Copy link
Contributor Author

@anandolee @pherl Freezing has been removed in #654 and #659. Once Travis becomes green, this should be ready to merge.

@jtattermusch
Copy link
Contributor Author

Travis is green with the exception of jruby test, which I don't believe is related to this PR, because it was definitely passing before we passing in the past and the most recent PRs couldn't have really caused it.

@anandolee
Copy link
Contributor

All the code in charp experimental are reviewed previously.
LGTM

@liujisi
Copy link
Contributor

liujisi commented Jul 30, 2015

Could you please double check the CLA tag?

@jtattermusch
Copy link
Contributor Author

CLA is red because googlebot doesn't correctly handle situations where the autor field of the commit is not the same as the commiter field. That happens when you are merging branch that contains commits from multiple contributors. I've doublechecked that all the commits in this PR are from Jon, Jie or me.

@liujisi
Copy link
Contributor

liujisi commented Jul 30, 2015

LGTM

jtattermusch added a commit that referenced this pull request Jul 30, 2015
Merge C# proto3 from csharp-experimental to master
@jtattermusch jtattermusch merged commit 12febd0 into master Jul 30, 2015
@jtattermusch
Copy link
Contributor Author

Wohoo!

@jtattermusch jtattermusch deleted the csharp-experimental branch July 31, 2015 08:21
bithium pushed a commit to bithium/protobuf that referenced this pull request Sep 4, 2023
Merge C# proto3 from csharp-experimental to master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants