commit
e65887ad0e
1185 changed files with 96005 additions and 65530 deletions
@ -0,0 +1,3 @@ |
||||
# These are fetched as external repositories. |
||||
third_party/benchmark |
||||
third_party/googletest |
@ -0,0 +1,16 @@ |
||||
# GitHub Action to automate the identification of common misspellings in text files. |
||||
# https://github.com/codespell-project/actions-codespell |
||||
# https://github.com/codespell-project/codespell |
||||
name: codespell |
||||
on: [push, pull_request] |
||||
jobs: |
||||
codespell: |
||||
name: Check for spelling errors |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: actions/checkout@v2 |
||||
- uses: codespell-project/actions-codespell@master |
||||
with: |
||||
check_filenames: true |
||||
skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal |
||||
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,files',fo,fundementals,hel,importd,inout,leapyear,nd,ois,ons,parseable,process',te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od" |
@ -0,0 +1,22 @@ |
||||
# .readthedocs.yml |
||||
# Read the Docs configuration file |
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details |
||||
|
||||
# Required |
||||
version: 2 |
||||
|
||||
sphinx: |
||||
configuration: python/docs/conf.py |
||||
fail_on_warning: false |
||||
|
||||
# Setup build requirements for docs. |
||||
# Use conda so that we can install the latest libprotobuf package without |
||||
# having to build from scratch just for docs builds. |
||||
conda: |
||||
environment: python/docs/environment.yml |
||||
|
||||
python: |
||||
version: 3.7 |
||||
install: |
||||
- method: setuptools |
||||
path: python |
@ -1,2 +1,3 @@ |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput |
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator |
||||
|
@ -1,115 +0,0 @@ |
||||
|
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput |
||||
Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput |
@ -1,109 +1,2 @@ |
||||
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput |
||||
Recommended.FieldMaskPathsDontRoundTrip.JsonOutput |
||||
Recommended.FieldMaskTooManyUnderscore.JsonOutput |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput |
||||
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter |
||||
Recommended.Proto3.JsonInput.MapFieldValueIsNull |
||||
Recommended.Proto3.JsonInput.OneofZeroBytes.JsonOutput |
||||
Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull |
||||
Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull |
||||
Recommended.Proto3.JsonInput.StringEndsWithEscapeChar |
||||
Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder |
||||
Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate |
||||
Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate |
||||
Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator |
||||
Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[3].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput |
||||
Required.DurationProtoInputTooLarge.JsonOutput |
||||
Required.DurationProtoInputTooSmall.JsonOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput |
||||
Required.Proto3.JsonInput.DurationMinValue.JsonOutput |
||||
Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput |
||||
Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput |
||||
Required.Proto3.JsonInput.FloatFieldNan.JsonOutput |
||||
Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput |
||||
Required.Proto3.JsonInput.OneofFieldDuplicate |
||||
Required.Proto3.JsonInput.RejectTopLevelNull |
||||
Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput |
||||
Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].JsonOutput |
||||
Required.TimestampProtoInputTooLarge.JsonOutput |
||||
Required.TimestampProtoInputTooSmall.JsonOutput |
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator |
||||
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator |
||||
|
@ -1,142 +0,0 @@ |
||||
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput |
||||
Recommended.FieldMaskPathsDontRoundTrip.JsonOutput |
||||
Recommended.FieldMaskTooManyUnderscore.JsonOutput |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput |
||||
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator |
||||
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter |
||||
Recommended.Proto3.JsonInput.MapFieldValueIsNull |
||||
Recommended.Proto3.JsonInput.OneofZeroBytes.JsonOutput |
||||
Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull |
||||
Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull |
||||
Recommended.Proto3.JsonInput.StringEndsWithEscapeChar |
||||
Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder |
||||
Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate |
||||
Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate |
||||
Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.TimestampHas9FractionalDigits.Validator |
||||
Recommended.Proto3.JsonInput.TimestampHasZeroFractionalDigit.Validator |
||||
Recommended.Proto3.JsonInput.TimestampZeroNormalized.Validator |
||||
Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[3].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput |
||||
Required.DurationProtoInputTooLarge.JsonOutput |
||||
Required.DurationProtoInputTooSmall.JsonOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput |
||||
Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput |
||||
Required.Proto3.JsonInput.DurationMaxValue.JsonOutput |
||||
Required.Proto3.JsonInput.DurationMaxValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.DurationMinValue.JsonOutput |
||||
Required.Proto3.JsonInput.DurationMinValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput |
||||
Required.Proto3.JsonInput.DurationRepeatedValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput |
||||
Required.Proto3.JsonInput.FloatFieldNan.JsonOutput |
||||
Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput |
||||
Required.Proto3.JsonInput.Int64FieldMaxValue.JsonOutput |
||||
Required.Proto3.JsonInput.Int64FieldMaxValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.Int64FieldMaxValueNotQuoted.JsonOutput |
||||
Required.Proto3.JsonInput.Int64FieldMaxValueNotQuoted.ProtobufOutput |
||||
Required.Proto3.JsonInput.Int64FieldMinValue.JsonOutput |
||||
Required.Proto3.JsonInput.Int64FieldMinValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.Int64FieldMinValueNotQuoted.JsonOutput |
||||
Required.Proto3.JsonInput.Int64FieldMinValueNotQuoted.ProtobufOutput |
||||
Required.Proto3.JsonInput.OneofFieldDuplicate |
||||
Required.Proto3.JsonInput.RejectTopLevelNull |
||||
Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput |
||||
Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput |
||||
Required.Proto3.JsonInput.TimestampLeap.JsonOutput |
||||
Required.Proto3.JsonInput.TimestampLeap.ProtobufOutput |
||||
Required.Proto3.JsonInput.TimestampMaxValue.JsonOutput |
||||
Required.Proto3.JsonInput.TimestampMaxValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.TimestampMinValue.JsonOutput |
||||
Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput |
||||
Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.TimestampWithNegativeOffset.JsonOutput |
||||
Required.Proto3.JsonInput.TimestampWithNegativeOffset.ProtobufOutput |
||||
Required.Proto3.JsonInput.TimestampWithPositiveOffset.JsonOutput |
||||
Required.Proto3.JsonInput.TimestampWithPositiveOffset.ProtobufOutput |
||||
Required.Proto3.JsonInput.Uint64FieldMaxValue.JsonOutput |
||||
Required.Proto3.JsonInput.Uint64FieldMaxValue.ProtobufOutput |
||||
Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput |
||||
Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.JsonOutput |
||||
Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.ProtobufOutput |
||||
Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].JsonOutput |
||||
Required.TimestampProtoInputTooLarge.JsonOutput |
||||
Required.TimestampProtoInputTooSmall.JsonOutput |
@ -1,31 +0,0 @@ |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput |
||||
Recommended.Proto3.JsonInput.DoubleFieldInfinityNotQuoted |
||||
Recommended.Proto3.JsonInput.DoubleFieldNanNotQuoted |
||||
Recommended.Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted |
||||
Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted |
||||
Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted |
||||
Recommended.Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BYTES[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.DOUBLE[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED32[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED64[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[6].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED32[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[0].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[5].ProtobufOutput |
||||
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[0].ProtobufOutput |
||||
Required.Proto3.JsonInput.DoubleFieldTooSmall |
||||
Required.Proto3.JsonInput.FloatFieldTooLarge |
||||
Required.Proto3.JsonInput.FloatFieldTooSmall |
||||
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool |
||||
Required.Proto3.JsonInput.TimestampJsonInputLowercaseT |
@ -0,0 +1,20 @@ |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString |
||||
Required.Proto3.TextFormatInput.StringFieldBadUTF8Hex |
||||
Required.Proto3.TextFormatInput.StringFieldBadUTF8Octal |
||||
Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes |
||||
Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString |
@ -0,0 +1,36 @@ |
||||
# This is the list of text format conformance tests that are known to fail right |
||||
# now. |
||||
# TODO: These should be fixed. |
||||
Required.Proto3.TextFormatInput.FloatFieldMaxValue.ProtobufOutput |
||||
Required.Proto3.TextFormatInput.FloatFieldMaxValue.TextFormatOutput |
||||
|
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes |
||||
Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString |
@ -0,0 +1,28 @@ |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput |
@ -0,0 +1,30 @@ |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes |
||||
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput |
||||
Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes |
||||
Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString |
@ -0,0 +1,64 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// https://developers.google.com/protocol-buffers/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
syntax = "proto2"; |
||||
|
||||
package protobuf_unittest_selfreferential_options; |
||||
option csharp_namespace = "UnitTest.Issues.TestProtos.SelfreferentialOptions"; |
||||
|
||||
import "google/protobuf/descriptor.proto"; |
||||
|
||||
message FooOptions { |
||||
// Custom field option used in definition of the extension message. |
||||
optional int32 int_opt = 1 [(foo_options) = { |
||||
int_opt: 1 |
||||
[foo_int_opt]: 2 |
||||
[foo_foo_opt]: { |
||||
int_opt: 3 |
||||
} |
||||
}]; |
||||
|
||||
// Custom field option used in definition of the custom option's message. |
||||
optional int32 foo = 2 [(foo_options) = {foo: 1234}]; |
||||
|
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
extend google.protobuf.FieldOptions { |
||||
// Custom field option used on the definition of that field option. |
||||
optional int32 bar_options = 1000 [(bar_options) = 1234]; |
||||
|
||||
optional FooOptions foo_options = 1001; |
||||
} |
||||
|
||||
extend FooOptions { |
||||
optional int32 foo_int_opt = 1000; |
||||
optional FooOptions foo_foo_opt = 1001; |
||||
} |
@ -0,0 +1,72 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2019 Google Inc. All rights reserved. |
||||
// https://github.com/protocolbuffers/protobuf |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using BenchmarkDotNet.Attributes; |
||||
|
||||
namespace Google.Protobuf.Benchmarks |
||||
{ |
||||
/// <summary> |
||||
/// Benchmarks using ByteString. |
||||
/// </summary> |
||||
[MemoryDiagnoser] |
||||
public class ByteStringBenchmark |
||||
{ |
||||
private const int Zero = 0; |
||||
private const int Kilobyte = 1024; |
||||
private const int _128Kilobytes = 1024 * 128; |
||||
private const int Megabyte = 1024 * 1024; |
||||
private const int _10Megabytes = 1024 * 1024 * 10; |
||||
|
||||
byte[] byteBuffer; |
||||
|
||||
[GlobalSetup] |
||||
public void GlobalSetup() |
||||
{ |
||||
byteBuffer = new byte[PayloadSize]; |
||||
} |
||||
|
||||
[Params(Zero, Kilobyte, _128Kilobytes, Megabyte, _10Megabytes)] |
||||
public int PayloadSize { get; set; } |
||||
|
||||
[Benchmark] |
||||
public ByteString CopyFrom() |
||||
{ |
||||
return ByteString.CopyFrom(byteBuffer); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public ByteString UnsafeWrap() |
||||
{ |
||||
return UnsafeByteOperations.UnsafeWrap(byteBuffer); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,258 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2019 Google Inc. All rights reserved. |
||||
// https://github.com/protocolbuffers/protobuf |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using BenchmarkDotNet.Attributes; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Buffers; |
||||
using Google.Protobuf.WellKnownTypes; |
||||
using Benchmarks.Proto3; |
||||
|
||||
namespace Google.Protobuf.Benchmarks |
||||
{ |
||||
/// <summary> |
||||
/// Benchmark that tests parsing performance for various messages. |
||||
/// </summary> |
||||
[MemoryDiagnoser] |
||||
public class ParseMessagesBenchmark |
||||
{ |
||||
const int MaxMessages = 100; |
||||
|
||||
SubTest manyWrapperFieldsTest = new SubTest(CreateManyWrapperFieldsMessage(), ManyWrapperFieldsMessage.Parser, () => new ManyWrapperFieldsMessage(), MaxMessages); |
||||
SubTest manyPrimitiveFieldsTest = new SubTest(CreateManyPrimitiveFieldsMessage(), ManyPrimitiveFieldsMessage.Parser, () => new ManyPrimitiveFieldsMessage(), MaxMessages); |
||||
SubTest repeatedFieldTest = new SubTest(CreateRepeatedFieldMessage(), GoogleMessage1.Parser, () => new GoogleMessage1(), MaxMessages); |
||||
SubTest emptyMessageTest = new SubTest(new Empty(), Empty.Parser, () => new Empty(), MaxMessages); |
||||
|
||||
public IEnumerable<int> MessageCountValues => new[] { 10, 100 }; |
||||
|
||||
[GlobalSetup] |
||||
public void GlobalSetup() |
||||
{ |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage ManyWrapperFieldsMessage_ParseFromByteArray() |
||||
{ |
||||
return manyWrapperFieldsTest.ParseFromByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage ManyWrapperFieldsMessage_ParseFromReadOnlySequence() |
||||
{ |
||||
return manyWrapperFieldsTest.ParseFromReadOnlySequence(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage ManyPrimitiveFieldsMessage_ParseFromByteArray() |
||||
{ |
||||
return manyPrimitiveFieldsTest.ParseFromByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage ManyPrimitiveFieldsMessage_ParseFromReadOnlySequence() |
||||
{ |
||||
return manyPrimitiveFieldsTest.ParseFromReadOnlySequence(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage RepeatedFieldMessage_ParseFromByteArray() |
||||
{ |
||||
return repeatedFieldTest.ParseFromByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage RepeatedFieldMessage_ParseFromReadOnlySequence() |
||||
{ |
||||
return repeatedFieldTest.ParseFromReadOnlySequence(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage EmptyMessage_ParseFromByteArray() |
||||
{ |
||||
return emptyMessageTest.ParseFromByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public IMessage EmptyMessage_ParseFromReadOnlySequence() |
||||
{ |
||||
return emptyMessageTest.ParseFromReadOnlySequence(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyWrapperFieldsMessage_ParseDelimitedMessagesFromByteArray(int messageCount) |
||||
{ |
||||
manyWrapperFieldsTest.ParseDelimitedMessagesFromByteArray(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyWrapperFieldsMessage_ParseDelimitedMessagesFromReadOnlySequence(int messageCount) |
||||
{ |
||||
manyWrapperFieldsTest.ParseDelimitedMessagesFromReadOnlySequence(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyPrimitiveFieldsMessage_ParseDelimitedMessagesFromByteArray(int messageCount) |
||||
{ |
||||
manyPrimitiveFieldsTest.ParseDelimitedMessagesFromByteArray(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyPrimitiveFieldsMessage_ParseDelimitedMessagesFromReadOnlySequence(int messageCount) |
||||
{ |
||||
manyPrimitiveFieldsTest.ParseDelimitedMessagesFromReadOnlySequence(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void RepeatedFieldMessage_ParseDelimitedMessagesFromByteArray(int messageCount) |
||||
{ |
||||
repeatedFieldTest.ParseDelimitedMessagesFromByteArray(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void RepeatedFieldMessage_ParseDelimitedMessagesFromReadOnlySequence(int messageCount) |
||||
{ |
||||
repeatedFieldTest.ParseDelimitedMessagesFromReadOnlySequence(messageCount); |
||||
} |
||||
|
||||
public static ManyWrapperFieldsMessage CreateManyWrapperFieldsMessage() |
||||
{ |
||||
// Example data match data of an internal benchmarks |
||||
return new ManyWrapperFieldsMessage() |
||||
{ |
||||
Int64Field19 = 123, |
||||
Int64Field37 = 1000032, |
||||
Int64Field26 = 3453524500, |
||||
DoubleField79 = 1.2, |
||||
DoubleField25 = 234, |
||||
DoubleField9 = 123.3, |
||||
DoubleField28 = 23, |
||||
DoubleField7 = 234, |
||||
DoubleField50 = 2.45 |
||||
}; |
||||
} |
||||
|
||||
public static ManyPrimitiveFieldsMessage CreateManyPrimitiveFieldsMessage() |
||||
{ |
||||
// Example data match data of an internal benchmarks |
||||
return new ManyPrimitiveFieldsMessage() |
||||
{ |
||||
Int64Field19 = 123, |
||||
Int64Field37 = 1000032, |
||||
Int64Field26 = 3453524500, |
||||
DoubleField79 = 1.2, |
||||
DoubleField25 = 234, |
||||
DoubleField9 = 123.3, |
||||
DoubleField28 = 23, |
||||
DoubleField7 = 234, |
||||
DoubleField50 = 2.45 |
||||
}; |
||||
} |
||||
|
||||
public static GoogleMessage1 CreateRepeatedFieldMessage() |
||||
{ |
||||
// Message with a repeated fixed length item collection |
||||
var message = new GoogleMessage1(); |
||||
for (ulong i = 0; i < 1000; i++) |
||||
{ |
||||
message.Field5.Add(i); |
||||
} |
||||
return message; |
||||
} |
||||
|
||||
private class SubTest |
||||
{ |
||||
private readonly IMessage message; |
||||
private readonly MessageParser parser; |
||||
private readonly Func<IMessage> factory; |
||||
private readonly byte[] data; |
||||
private readonly byte[] multipleMessagesData; |
||||
|
||||
private ReadOnlySequence<byte> dataSequence; |
||||
private ReadOnlySequence<byte> multipleMessagesDataSequence; |
||||
|
||||
public SubTest(IMessage message, MessageParser parser, Func<IMessage> factory, int maxMessageCount) |
||||
{ |
||||
this.message = message; |
||||
this.parser = parser; |
||||
this.factory = factory; |
||||
this.data = message.ToByteArray(); |
||||
this.multipleMessagesData = CreateBufferWithMultipleMessages(message, maxMessageCount); |
||||
this.dataSequence = new ReadOnlySequence<byte>(this.data); |
||||
this.multipleMessagesDataSequence = new ReadOnlySequence<byte>(this.multipleMessagesData); |
||||
} |
||||
|
||||
public IMessage ParseFromByteArray() => parser.ParseFrom(data); |
||||
|
||||
public IMessage ParseFromReadOnlySequence() => parser.ParseFrom(dataSequence); |
||||
|
||||
public void ParseDelimitedMessagesFromByteArray(int messageCount) |
||||
{ |
||||
var input = new CodedInputStream(multipleMessagesData); |
||||
for (int i = 0; i < messageCount; i++) |
||||
{ |
||||
var msg = factory(); |
||||
input.ReadMessage(msg); |
||||
} |
||||
} |
||||
|
||||
public void ParseDelimitedMessagesFromReadOnlySequence(int messageCount) |
||||
{ |
||||
ParseContext.Initialize(multipleMessagesDataSequence, out ParseContext ctx); |
||||
for (int i = 0; i < messageCount; i++) |
||||
{ |
||||
var msg = factory(); |
||||
ctx.ReadMessage(msg); |
||||
} |
||||
} |
||||
|
||||
private static byte[] CreateBufferWithMultipleMessages(IMessage msg, int msgCount) |
||||
{ |
||||
var ms = new MemoryStream(); |
||||
var cos = new CodedOutputStream(ms); |
||||
for (int i = 0; i < msgCount; i++) |
||||
{ |
||||
cos.WriteMessage(msg); |
||||
} |
||||
cos.Flush(); |
||||
return ms.ToArray(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,536 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2019 Google Inc. All rights reserved. |
||||
// https://github.com/protocolbuffers/protobuf |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using BenchmarkDotNet.Attributes; |
||||
using System; |
||||
using System.Buffers.Binary; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Buffers; |
||||
|
||||
namespace Google.Protobuf.Benchmarks |
||||
{ |
||||
/// <summary> |
||||
/// Benchmarks throughput when parsing raw primitives. |
||||
/// </summary> |
||||
[MemoryDiagnoser] |
||||
public class ParseRawPrimitivesBenchmark |
||||
{ |
||||
// key is the encodedSize of varint values |
||||
Dictionary<int, byte[]> varintInputBuffers; |
||||
|
||||
byte[] doubleInputBuffer; |
||||
byte[] floatInputBuffer; |
||||
byte[] fixedIntInputBuffer; |
||||
|
||||
// key is the encodedSize of string values |
||||
Dictionary<int, byte[]> stringInputBuffers; |
||||
Dictionary<int, ReadOnlySequence<byte>> stringInputBuffersSegmented; |
||||
|
||||
Random random = new Random(417384220); // random but deterministic seed |
||||
|
||||
public IEnumerable<int> StringEncodedSizes => new[] { 1, 4, 10, 105, 10080 }; |
||||
public IEnumerable<int> StringSegmentedEncodedSizes => new[] { 105, 10080 }; |
||||
|
||||
[GlobalSetup] |
||||
public void GlobalSetup() |
||||
{ |
||||
// add some extra values that we won't read just to make sure we are far enough from the end of the buffer |
||||
// which allows the parser fastpath to always kick in. |
||||
const int paddingValueCount = 100; |
||||
|
||||
varintInputBuffers = new Dictionary<int, byte[]>(); |
||||
for (int encodedSize = 1; encodedSize <= 10; encodedSize++) |
||||
{ |
||||
byte[] buffer = CreateBufferWithRandomVarints(random, BytesToParse / encodedSize, encodedSize, paddingValueCount); |
||||
varintInputBuffers.Add(encodedSize, buffer); |
||||
} |
||||
|
||||
doubleInputBuffer = CreateBufferWithRandomDoubles(random, BytesToParse / sizeof(double), paddingValueCount); |
||||
floatInputBuffer = CreateBufferWithRandomFloats(random, BytesToParse / sizeof(float), paddingValueCount); |
||||
fixedIntInputBuffer = CreateBufferWithRandomData(random, BytesToParse / sizeof(long), sizeof(long), paddingValueCount); |
||||
|
||||
stringInputBuffers = new Dictionary<int, byte[]>(); |
||||
foreach (var encodedSize in StringEncodedSizes) |
||||
{ |
||||
byte[] buffer = CreateBufferWithStrings(BytesToParse / encodedSize, encodedSize, encodedSize < 10 ? 10 : 1 ); |
||||
stringInputBuffers.Add(encodedSize, buffer); |
||||
} |
||||
|
||||
stringInputBuffersSegmented = new Dictionary<int, ReadOnlySequence<byte>>(); |
||||
foreach (var encodedSize in StringSegmentedEncodedSizes) |
||||
{ |
||||
byte[] buffer = CreateBufferWithStrings(BytesToParse / encodedSize, encodedSize, encodedSize < 10 ? 10 : 1); |
||||
stringInputBuffersSegmented.Add(encodedSize, ReadOnlySequenceFactory.CreateWithContent(buffer, segmentSize: 128, addEmptySegmentDelimiters: false)); |
||||
} |
||||
} |
||||
|
||||
// Total number of bytes that each benchmark will parse. |
||||
// Measuring the time taken to parse buffer of given size makes it easier to compare parsing speed for different |
||||
// types and makes it easy to calculate the througput (in MB/s) |
||||
// 10800 bytes is chosen because it is divisible by all possible encoded sizes for all primitive types {1..10} |
||||
[Params(10080)] |
||||
public int BytesToParse { get; set; } |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
public int ParseRawVarint32_CodedInputStream(int encodedSize) |
||||
{ |
||||
CodedInputStream cis = new CodedInputStream(varintInputBuffers[encodedSize]); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadInt32(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
public int ParseRawVarint32_ParseContext(int encodedSize) |
||||
{ |
||||
InitializeParseContext(varintInputBuffers[encodedSize], out ParseContext ctx); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadInt32(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
[Arguments(6)] |
||||
[Arguments(7)] |
||||
[Arguments(8)] |
||||
[Arguments(9)] |
||||
[Arguments(10)] |
||||
public long ParseRawVarint64_CodedInputStream(int encodedSize) |
||||
{ |
||||
CodedInputStream cis = new CodedInputStream(varintInputBuffers[encodedSize]); |
||||
long sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadInt64(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
[Arguments(6)] |
||||
[Arguments(7)] |
||||
[Arguments(8)] |
||||
[Arguments(9)] |
||||
[Arguments(10)] |
||||
public long ParseRawVarint64_ParseContext(int encodedSize) |
||||
{ |
||||
InitializeParseContext(varintInputBuffers[encodedSize], out ParseContext ctx); |
||||
long sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadInt64(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public uint ParseFixed32_CodedInputStream() |
||||
{ |
||||
const int encodedSize = sizeof(uint); |
||||
CodedInputStream cis = new CodedInputStream(fixedIntInputBuffer); |
||||
uint sum = 0; |
||||
for (uint i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadFixed32(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public uint ParseFixed32_ParseContext() |
||||
{ |
||||
const int encodedSize = sizeof(uint); |
||||
InitializeParseContext(fixedIntInputBuffer, out ParseContext ctx); |
||||
uint sum = 0; |
||||
for (uint i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadFixed32(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public ulong ParseFixed64_CodedInputStream() |
||||
{ |
||||
const int encodedSize = sizeof(ulong); |
||||
CodedInputStream cis = new CodedInputStream(fixedIntInputBuffer); |
||||
ulong sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadFixed64(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public ulong ParseFixed64_ParseContext() |
||||
{ |
||||
const int encodedSize = sizeof(ulong); |
||||
InitializeParseContext(fixedIntInputBuffer, out ParseContext ctx); |
||||
ulong sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadFixed64(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public float ParseRawFloat_CodedInputStream() |
||||
{ |
||||
const int encodedSize = sizeof(float); |
||||
CodedInputStream cis = new CodedInputStream(floatInputBuffer); |
||||
float sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadFloat(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public float ParseRawFloat_ParseContext() |
||||
{ |
||||
const int encodedSize = sizeof(float); |
||||
InitializeParseContext(floatInputBuffer, out ParseContext ctx); |
||||
float sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadFloat(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public double ParseRawDouble_CodedInputStream() |
||||
{ |
||||
const int encodedSize = sizeof(double); |
||||
CodedInputStream cis = new CodedInputStream(doubleInputBuffer); |
||||
double sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadDouble(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
public double ParseRawDouble_ParseContext() |
||||
{ |
||||
const int encodedSize = sizeof(double); |
||||
InitializeParseContext(doubleInputBuffer, out ParseContext ctx); |
||||
double sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadDouble(); |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public int ParseString_CodedInputStream(int encodedSize) |
||||
{ |
||||
CodedInputStream cis = new CodedInputStream(stringInputBuffers[encodedSize]); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadString().Length; |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public int ParseString_ParseContext(int encodedSize) |
||||
{ |
||||
InitializeParseContext(stringInputBuffers[encodedSize], out ParseContext ctx); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadString().Length; |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringSegmentedEncodedSizes))] |
||||
public int ParseString_ParseContext_MultipleSegments(int encodedSize) |
||||
{ |
||||
InitializeParseContext(stringInputBuffersSegmented[encodedSize], out ParseContext ctx); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadString().Length; |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public int ParseBytes_CodedInputStream(int encodedSize) |
||||
{ |
||||
CodedInputStream cis = new CodedInputStream(stringInputBuffers[encodedSize]); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += cis.ReadBytes().Length; |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public int ParseBytes_ParseContext(int encodedSize) |
||||
{ |
||||
InitializeParseContext(stringInputBuffers[encodedSize], out ParseContext ctx); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadBytes().Length; |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringSegmentedEncodedSizes))] |
||||
public int ParseBytes_ParseContext_MultipleSegments(int encodedSize) |
||||
{ |
||||
InitializeParseContext(stringInputBuffersSegmented[encodedSize], out ParseContext ctx); |
||||
int sum = 0; |
||||
for (int i = 0; i < BytesToParse / encodedSize; i++) |
||||
{ |
||||
sum += ctx.ReadBytes().Length; |
||||
} |
||||
return sum; |
||||
} |
||||
|
||||
private static void InitializeParseContext(byte[] buffer, out ParseContext ctx) |
||||
{ |
||||
ParseContext.Initialize(new ReadOnlySequence<byte>(buffer), out ctx); |
||||
} |
||||
|
||||
private static void InitializeParseContext(ReadOnlySequence<byte> buffer, out ParseContext ctx) |
||||
{ |
||||
ParseContext.Initialize(buffer, out ctx); |
||||
} |
||||
|
||||
private static byte[] CreateBufferWithRandomVarints(Random random, int valueCount, int encodedSize, int paddingValueCount) |
||||
{ |
||||
MemoryStream ms = new MemoryStream(); |
||||
CodedOutputStream cos = new CodedOutputStream(ms); |
||||
for (int i = 0; i < valueCount + paddingValueCount; i++) |
||||
{ |
||||
cos.WriteUInt64(RandomUnsignedVarint(random, encodedSize, false)); |
||||
} |
||||
cos.Flush(); |
||||
var buffer = ms.ToArray(); |
||||
|
||||
if (buffer.Length != encodedSize * (valueCount + paddingValueCount)) |
||||
{ |
||||
throw new InvalidOperationException($"Unexpected output buffer length {buffer.Length}"); |
||||
} |
||||
return buffer; |
||||
} |
||||
|
||||
private static byte[] CreateBufferWithRandomFloats(Random random, int valueCount, int paddingValueCount) |
||||
{ |
||||
MemoryStream ms = new MemoryStream(); |
||||
CodedOutputStream cos = new CodedOutputStream(ms); |
||||
for (int i = 0; i < valueCount + paddingValueCount; i++) |
||||
{ |
||||
cos.WriteFloat((float)random.NextDouble()); |
||||
} |
||||
cos.Flush(); |
||||
var buffer = ms.ToArray(); |
||||
return buffer; |
||||
} |
||||
|
||||
private static byte[] CreateBufferWithRandomDoubles(Random random, int valueCount, int paddingValueCount) |
||||
{ |
||||
MemoryStream ms = new MemoryStream(); |
||||
CodedOutputStream cos = new CodedOutputStream(ms); |
||||
for (int i = 0; i < valueCount + paddingValueCount; i++) |
||||
{ |
||||
cos.WriteDouble(random.NextDouble()); |
||||
} |
||||
cos.Flush(); |
||||
var buffer = ms.ToArray(); |
||||
return buffer; |
||||
} |
||||
|
||||
private static byte[] CreateBufferWithRandomData(Random random, int valueCount, int encodedSize, int paddingValueCount) |
||||
{ |
||||
int bufferSize = (valueCount + paddingValueCount) * encodedSize; |
||||
byte[] buffer = new byte[bufferSize]; |
||||
random.NextBytes(buffer); |
||||
return buffer; |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Generate a random value that will take exactly "encodedSize" bytes when varint-encoded. |
||||
/// </summary> |
||||
public static ulong RandomUnsignedVarint(Random random, int encodedSize, bool fitsIn32Bits) |
||||
{ |
||||
Span<byte> randomBytesBuffer = stackalloc byte[8]; |
||||
|
||||
if (encodedSize < 1 || encodedSize > 10 || (fitsIn32Bits && encodedSize > 5)) |
||||
{ |
||||
throw new ArgumentException("Illegal encodedSize value requested", nameof(encodedSize)); |
||||
} |
||||
const int bitsPerByte = 7; |
||||
|
||||
ulong result = 0; |
||||
while (true) |
||||
{ |
||||
random.NextBytes(randomBytesBuffer); |
||||
ulong randomValue = BinaryPrimitives.ReadUInt64LittleEndian(randomBytesBuffer); |
||||
|
||||
// only use the number of random bits we need |
||||
ulong bitmask = encodedSize < 10 ? ((1UL << (encodedSize * bitsPerByte)) - 1) : ulong.MaxValue; |
||||
result = randomValue & bitmask; |
||||
|
||||
if (fitsIn32Bits) |
||||
{ |
||||
// make sure the resulting value is representable by a uint. |
||||
result &= uint.MaxValue; |
||||
} |
||||
|
||||
if (encodedSize == 10) |
||||
{ |
||||
// for 10-byte values the highest bit always needs to be set (7*9=63) |
||||
result |= ulong.MaxValue; |
||||
break; |
||||
} |
||||
|
||||
// some random values won't require the full "encodedSize" bytes, check that at least |
||||
// one of the top 7 bits is set. Retrying is fine since it only happens rarely |
||||
if (encodedSize == 1 || (result & (0x7FUL << ((encodedSize - 1) * bitsPerByte))) != 0) |
||||
{ |
||||
break; |
||||
} |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
private static byte[] CreateBufferWithStrings(int valueCount, int encodedSize, int paddingValueCount) |
||||
{ |
||||
var str = CreateStringWithEncodedSize(encodedSize); |
||||
|
||||
MemoryStream ms = new MemoryStream(); |
||||
CodedOutputStream cos = new CodedOutputStream(ms); |
||||
for (int i = 0; i < valueCount + paddingValueCount; i++) |
||||
{ |
||||
cos.WriteString(str); |
||||
} |
||||
cos.Flush(); |
||||
var buffer = ms.ToArray(); |
||||
|
||||
if (buffer.Length != encodedSize * (valueCount + paddingValueCount)) |
||||
{ |
||||
throw new InvalidOperationException($"Unexpected output buffer length {buffer.Length}"); |
||||
} |
||||
return buffer; |
||||
} |
||||
|
||||
public static string CreateStringWithEncodedSize(int encodedSize) |
||||
{ |
||||
var str = new string('a', encodedSize); |
||||
while (CodedOutputStream.ComputeStringSize(str) > encodedSize) |
||||
{ |
||||
str = str.Substring(1); |
||||
} |
||||
|
||||
if (CodedOutputStream.ComputeStringSize(str) != encodedSize) |
||||
{ |
||||
throw new InvalidOperationException($"Generated string with wrong encodedSize"); |
||||
} |
||||
return str; |
||||
} |
||||
|
||||
public static string CreateNonAsciiStringWithEncodedSize(int encodedSize) |
||||
{ |
||||
if (encodedSize < 3) |
||||
{ |
||||
throw new ArgumentException("Illegal encoded size for a string with non-ascii chars."); |
||||
} |
||||
var twoByteChar = '\u00DC'; // U-umlaut, UTF8 encoding has 2 bytes |
||||
var str = new string(twoByteChar, encodedSize / 2); |
||||
while (CodedOutputStream.ComputeStringSize(str) > encodedSize) |
||||
{ |
||||
str = str.Substring(1); |
||||
} |
||||
|
||||
// add padding of ascii characters to reach the desired encoded size. |
||||
while (CodedOutputStream.ComputeStringSize(str) < encodedSize) |
||||
{ |
||||
str += 'a'; |
||||
} |
||||
|
||||
// Note that for a few specific encodedSize values, it might be impossible to generate |
||||
// the string with the desired encodedSize using the algorithm above. For testing purposes, checking that |
||||
// the encoded size we got is actually correct is good enough. |
||||
if (CodedOutputStream.ComputeStringSize(str) != encodedSize) |
||||
{ |
||||
throw new InvalidOperationException($"Generated string with wrong encodedSize"); |
||||
} |
||||
return str; |
||||
} |
||||
} |
||||
} |
@ -1,102 +0,0 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2019 Google Inc. All rights reserved. |
||||
// https://github.com/protocolbuffers/protobuf |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using BenchmarkDotNet.Attributes; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Linq; |
||||
|
||||
namespace Google.Protobuf.Benchmarks |
||||
{ |
||||
/// <summary> |
||||
/// Benchmark that tests serialization/deserialization of wrapper fields. |
||||
/// </summary> |
||||
[MemoryDiagnoser] |
||||
public class WrapperBenchmark |
||||
{ |
||||
byte[] manyWrapperFieldsData; |
||||
byte[] manyPrimitiveFieldsData; |
||||
|
||||
[GlobalSetup] |
||||
public void GlobalSetup() |
||||
{ |
||||
manyWrapperFieldsData = CreateManyWrapperFieldsMessage().ToByteArray(); |
||||
manyPrimitiveFieldsData = CreateManyPrimitiveFieldsMessage().ToByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public ManyWrapperFieldsMessage ParseWrapperFields() |
||||
{ |
||||
return ManyWrapperFieldsMessage.Parser.ParseFrom(manyWrapperFieldsData); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public ManyPrimitiveFieldsMessage ParsePrimitiveFields() |
||||
{ |
||||
return ManyPrimitiveFieldsMessage.Parser.ParseFrom(manyPrimitiveFieldsData); |
||||
} |
||||
|
||||
private static ManyWrapperFieldsMessage CreateManyWrapperFieldsMessage() |
||||
{ |
||||
// Example data match data of an internal benchmarks |
||||
return new ManyWrapperFieldsMessage() |
||||
{ |
||||
Int64Field19 = 123, |
||||
Int64Field37 = 1000032, |
||||
Int64Field26 = 3453524500, |
||||
DoubleField79 = 1.2, |
||||
DoubleField25 = 234, |
||||
DoubleField9 = 123.3, |
||||
DoubleField28 = 23, |
||||
DoubleField7 = 234, |
||||
DoubleField50 = 2.45 |
||||
}; |
||||
} |
||||
|
||||
private static ManyPrimitiveFieldsMessage CreateManyPrimitiveFieldsMessage() |
||||
{ |
||||
// Example data match data of an internal benchmarks |
||||
return new ManyPrimitiveFieldsMessage() |
||||
{ |
||||
Int64Field19 = 123, |
||||
Int64Field37 = 1000032, |
||||
Int64Field26 = 3453524500, |
||||
DoubleField79 = 1.2, |
||||
DoubleField25 = 234, |
||||
DoubleField9 = 123.3, |
||||
DoubleField28 = 23, |
||||
DoubleField7 = 234, |
||||
DoubleField50 = 2.45 |
||||
}; |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,198 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2019 Google Inc. All rights reserved. |
||||
// https://github.com/protocolbuffers/protobuf |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using BenchmarkDotNet.Attributes; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Buffers; |
||||
using Google.Protobuf.WellKnownTypes; |
||||
|
||||
namespace Google.Protobuf.Benchmarks |
||||
{ |
||||
/// <summary> |
||||
/// Benchmark that tests writing performance for various messages. |
||||
/// </summary> |
||||
[MemoryDiagnoser] |
||||
public class WriteMessagesBenchmark |
||||
{ |
||||
const int MaxMessages = 100; |
||||
|
||||
SubTest manyWrapperFieldsTest = new SubTest(ParseMessagesBenchmark.CreateManyWrapperFieldsMessage(), MaxMessages); |
||||
SubTest manyPrimitiveFieldsTest = new SubTest(ParseMessagesBenchmark.CreateManyPrimitiveFieldsMessage(), MaxMessages); |
||||
SubTest emptyMessageTest = new SubTest(new Empty(), MaxMessages); |
||||
|
||||
public IEnumerable<int> MessageCountValues => new[] { 10, 100 }; |
||||
|
||||
[GlobalSetup] |
||||
public void GlobalSetup() |
||||
{ |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] ManyWrapperFieldsMessage_ToByteArray() |
||||
{ |
||||
return manyWrapperFieldsTest.ToByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] ManyWrapperFieldsMessage_WriteToCodedOutputStream() |
||||
{ |
||||
return manyWrapperFieldsTest.WriteToCodedOutputStream_PreAllocatedBuffer(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] ManyWrapperFieldsMessage_WriteToSpan() |
||||
{ |
||||
return manyWrapperFieldsTest.WriteToSpan_PreAllocatedBuffer(); |
||||
} |
||||
|
||||
|
||||
[Benchmark] |
||||
public byte[] ManyPrimitiveFieldsMessage_ToByteArray() |
||||
{ |
||||
return manyPrimitiveFieldsTest.ToByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] ManyPrimitiveFieldsMessage_WriteToCodedOutputStream() |
||||
{ |
||||
return manyPrimitiveFieldsTest.WriteToCodedOutputStream_PreAllocatedBuffer(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] ManyPrimitiveFieldsMessage_WriteToSpan() |
||||
{ |
||||
return manyPrimitiveFieldsTest.WriteToSpan_PreAllocatedBuffer(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] EmptyMessage_ToByteArray() |
||||
{ |
||||
return emptyMessageTest.ToByteArray(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] EmptyMessage_WriteToCodedOutputStream() |
||||
{ |
||||
return emptyMessageTest.WriteToCodedOutputStream_PreAllocatedBuffer(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public byte[] EmptyMessage_WriteToSpan() |
||||
{ |
||||
return emptyMessageTest.WriteToSpan_PreAllocatedBuffer(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyWrapperFieldsMessage_WriteDelimitedMessagesToCodedOutputStream(int messageCount) |
||||
{ |
||||
manyWrapperFieldsTest.WriteDelimitedMessagesToCodedOutputStream_PreAllocatedBuffer(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyWrapperFieldsMessage_WriteDelimitedMessagesToSpan(int messageCount) |
||||
{ |
||||
manyWrapperFieldsTest.WriteDelimitedMessagesToSpan_PreAllocatedBuffer(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyPrimitiveFieldsMessage_WriteDelimitedMessagesToCodedOutputStream(int messageCount) |
||||
{ |
||||
manyPrimitiveFieldsTest.WriteDelimitedMessagesToCodedOutputStream_PreAllocatedBuffer(messageCount); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(MessageCountValues))] |
||||
public void ManyPrimitiveFieldsMessage_WriteDelimitedMessagesToSpan(int messageCount) |
||||
{ |
||||
manyPrimitiveFieldsTest.WriteDelimitedMessagesToSpan_PreAllocatedBuffer(messageCount); |
||||
} |
||||
|
||||
private class SubTest |
||||
{ |
||||
private readonly IMessage message; |
||||
private readonly byte[] outputBuffer; |
||||
private readonly byte[] multipleMessagesOutputBuffer; |
||||
|
||||
public SubTest(IMessage message, int maxMessageCount) |
||||
{ |
||||
this.message = message; |
||||
|
||||
int messageSize = message.CalculateSize(); |
||||
this.outputBuffer = new byte[messageSize]; |
||||
this.multipleMessagesOutputBuffer = new byte[maxMessageCount * (messageSize + CodedOutputStream.ComputeLengthSize(messageSize))]; |
||||
} |
||||
|
||||
public byte[] ToByteArray() => message.ToByteArray(); |
||||
|
||||
public byte[] WriteToCodedOutputStream_PreAllocatedBuffer() |
||||
{ |
||||
var cos = new CodedOutputStream(outputBuffer); // use pre-existing output buffer |
||||
message.WriteTo(cos); |
||||
return outputBuffer; |
||||
} |
||||
|
||||
public byte[] WriteToSpan_PreAllocatedBuffer() |
||||
{ |
||||
var span = new Span<byte>(outputBuffer); // use pre-existing output buffer |
||||
message.WriteTo(span); |
||||
return outputBuffer; |
||||
} |
||||
|
||||
public byte[] WriteDelimitedMessagesToCodedOutputStream_PreAllocatedBuffer(int messageCount) |
||||
{ |
||||
var cos = new CodedOutputStream(multipleMessagesOutputBuffer); // use pre-existing output buffer |
||||
for (int i = 0; i < messageCount; i++) |
||||
{ |
||||
cos.WriteMessage(message); |
||||
} |
||||
return multipleMessagesOutputBuffer; |
||||
} |
||||
|
||||
public byte[] WriteDelimitedMessagesToSpan_PreAllocatedBuffer(int messageCount) |
||||
{ |
||||
var span = new Span<byte>(multipleMessagesOutputBuffer); // use pre-existing output buffer |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (int i = 0; i < messageCount; i++) |
||||
{ |
||||
ctx.WriteMessage(message); |
||||
} |
||||
return multipleMessagesOutputBuffer; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,519 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2019 Google Inc. All rights reserved. |
||||
// https://github.com/protocolbuffers/protobuf |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using BenchmarkDotNet.Attributes; |
||||
using System; |
||||
using System.Buffers.Binary; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Buffers; |
||||
using System.Text; |
||||
|
||||
namespace Google.Protobuf.Benchmarks |
||||
{ |
||||
/// <summary> |
||||
/// Benchmarks throughput when writing raw primitives. |
||||
/// </summary> |
||||
[MemoryDiagnoser] |
||||
public class WriteRawPrimitivesBenchmark |
||||
{ |
||||
// key is the encodedSize of varint values |
||||
Dictionary<int, uint[]> varint32Values; |
||||
Dictionary<int, ulong[]> varint64Values; |
||||
|
||||
double[] doubleValues; |
||||
float[] floatValues; |
||||
|
||||
// key is the encodedSize of string values |
||||
Dictionary<int, string[]> stringValues; |
||||
|
||||
// key is the encodedSize of string values |
||||
Dictionary<int, string[]> nonAsciiStringValues; |
||||
|
||||
// key is the encodedSize of string values |
||||
Dictionary<int, ByteString[]> byteStringValues; |
||||
|
||||
// the buffer to which all the data will be written |
||||
byte[] outputBuffer; |
||||
|
||||
Random random = new Random(417384220); // random but deterministic seed |
||||
|
||||
public IEnumerable<int> StringEncodedSizes => new[] { 1, 4, 10, 105, 10080 }; |
||||
|
||||
public IEnumerable<int> NonAsciiStringEncodedSizes => new[] { 4, 10, 105, 10080 }; |
||||
|
||||
[GlobalSetup] |
||||
public void GlobalSetup() |
||||
{ |
||||
outputBuffer = new byte[BytesToWrite]; |
||||
|
||||
varint32Values = new Dictionary<int, uint[]>(); |
||||
varint64Values = new Dictionary<int, ulong[]>(); |
||||
for (int encodedSize = 1; encodedSize <= 10; encodedSize++) |
||||
{ |
||||
if (encodedSize <= 5) |
||||
{ |
||||
varint32Values.Add(encodedSize, CreateRandomVarints32(random, BytesToWrite / encodedSize, encodedSize)); |
||||
} |
||||
varint64Values.Add(encodedSize, CreateRandomVarints64(random, BytesToWrite / encodedSize, encodedSize)); |
||||
} |
||||
|
||||
doubleValues = CreateRandomDoubles(random, BytesToWrite / sizeof(double)); |
||||
floatValues = CreateRandomFloats(random, BytesToWrite / sizeof(float)); |
||||
|
||||
stringValues = new Dictionary<int, string[]>(); |
||||
|
||||
byteStringValues = new Dictionary<int, ByteString[]>(); |
||||
foreach(var encodedSize in StringEncodedSizes) |
||||
{ |
||||
stringValues.Add(encodedSize, CreateStrings(BytesToWrite / encodedSize, encodedSize)); |
||||
byteStringValues.Add(encodedSize, CreateByteStrings(BytesToWrite / encodedSize, encodedSize)); |
||||
} |
||||
|
||||
nonAsciiStringValues = new Dictionary<int, string[]>(); |
||||
foreach(var encodedSize in NonAsciiStringEncodedSizes) |
||||
{ |
||||
nonAsciiStringValues.Add(encodedSize, CreateNonAsciiStrings(BytesToWrite / encodedSize, encodedSize)); |
||||
} |
||||
} |
||||
|
||||
// Total number of bytes that each benchmark will write. |
||||
// Measuring the time taken to write buffer of given size makes it easier to compare parsing speed for different |
||||
// types and makes it easy to calculate the througput (in MB/s) |
||||
// 10800 bytes is chosen because it is divisible by all possible encoded sizes for all primitive types {1..10} |
||||
[Params(10080)] |
||||
public int BytesToWrite { get; set; } |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
public void WriteRawVarint32_CodedOutputStream(int encodedSize) |
||||
{ |
||||
var values = varint32Values[encodedSize]; |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
for (int i = 0; i < values.Length; i++) |
||||
{ |
||||
cos.WriteRawVarint32(values[i]); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
public void WriteRawVarint32_WriteContext(int encodedSize) |
||||
{ |
||||
var values = varint32Values[encodedSize]; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (int i = 0; i < values.Length; i++) |
||||
{ |
||||
ctx.WriteUInt32(values[i]); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
[Arguments(6)] |
||||
[Arguments(7)] |
||||
[Arguments(8)] |
||||
[Arguments(9)] |
||||
[Arguments(10)] |
||||
public void WriteRawVarint64_CodedOutputStream(int encodedSize) |
||||
{ |
||||
var values = varint64Values[encodedSize]; |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
for (int i = 0; i < values.Length; i++) |
||||
{ |
||||
cos.WriteRawVarint64(values[i]); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[Arguments(1)] |
||||
[Arguments(2)] |
||||
[Arguments(3)] |
||||
[Arguments(4)] |
||||
[Arguments(5)] |
||||
[Arguments(6)] |
||||
[Arguments(7)] |
||||
[Arguments(8)] |
||||
[Arguments(9)] |
||||
[Arguments(10)] |
||||
public void WriteRawVarint64_WriteContext(int encodedSize) |
||||
{ |
||||
var values = varint64Values[encodedSize]; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (int i = 0; i < values.Length; i++) |
||||
{ |
||||
ctx.WriteUInt64(values[i]); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteFixed32_CodedOutputStream() |
||||
{ |
||||
const int encodedSize = sizeof(uint); |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
for (int i = 0; i < BytesToWrite / encodedSize; i++) |
||||
{ |
||||
cos.WriteFixed32(12345); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteFixed32_WriteContext() |
||||
{ |
||||
const int encodedSize = sizeof(uint); |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (uint i = 0; i < BytesToWrite / encodedSize; i++) |
||||
{ |
||||
ctx.WriteFixed32(12345); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteFixed64_CodedOutputStream() |
||||
{ |
||||
const int encodedSize = sizeof(ulong); |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
for(int i = 0; i < BytesToWrite / encodedSize; i++) |
||||
{ |
||||
cos.WriteFixed64(123456789); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteFixed64_WriteContext() |
||||
{ |
||||
const int encodedSize = sizeof(ulong); |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (uint i = 0; i < BytesToWrite / encodedSize; i++) |
||||
{ |
||||
ctx.WriteFixed64(123456789); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteRawTag_OneByte_WriteContext() |
||||
{ |
||||
const int encodedSize = 1; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (uint i = 0; i < BytesToWrite / encodedSize; i++) |
||||
{ |
||||
ctx.WriteRawTag(16); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteRawTag_TwoBytes_WriteContext() |
||||
{ |
||||
const int encodedSize = 2; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (uint i = 0; i < BytesToWrite / encodedSize; i++) |
||||
{ |
||||
ctx.WriteRawTag(137, 6); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteRawTag_ThreeBytes_WriteContext() |
||||
{ |
||||
const int encodedSize = 3; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
for (uint i = 0; i < BytesToWrite / encodedSize; i++) |
||||
{ |
||||
ctx.WriteRawTag(160, 131, 1); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void Baseline_WriteContext() |
||||
{ |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
ctx.state.position = outputBuffer.Length; |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteRawFloat_CodedOutputStream() |
||||
{ |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
foreach (var value in floatValues) |
||||
{ |
||||
cos.WriteFloat(value); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteRawFloat_WriteContext() |
||||
{ |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
foreach (var value in floatValues) |
||||
{ |
||||
ctx.WriteFloat(value); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteRawDouble_CodedOutputStream() |
||||
{ |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
foreach (var value in doubleValues) |
||||
{ |
||||
cos.WriteDouble(value); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
public void WriteRawDouble_WriteContext() |
||||
{ |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
foreach (var value in doubleValues) |
||||
{ |
||||
ctx.WriteDouble(value); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public void WriteString_CodedOutputStream(int encodedSize) |
||||
{ |
||||
var values = stringValues[encodedSize]; |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
foreach (var value in values) |
||||
{ |
||||
cos.WriteString(value); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public void WriteString_WriteContext(int encodedSize) |
||||
{ |
||||
var values = stringValues[encodedSize]; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
foreach (var value in values) |
||||
{ |
||||
ctx.WriteString(value); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(NonAsciiStringEncodedSizes))] |
||||
public void WriteNonAsciiString_CodedOutputStream(int encodedSize) |
||||
{ |
||||
var values = nonAsciiStringValues[encodedSize]; |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
foreach (var value in values) |
||||
{ |
||||
cos.WriteString(value); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(NonAsciiStringEncodedSizes))] |
||||
public void WriteNonAsciiString_WriteContext(int encodedSize) |
||||
{ |
||||
var values = nonAsciiStringValues[encodedSize]; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
foreach (var value in values) |
||||
{ |
||||
ctx.WriteString(value); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public void WriteBytes_CodedOutputStream(int encodedSize) |
||||
{ |
||||
var values = byteStringValues[encodedSize]; |
||||
var cos = new CodedOutputStream(outputBuffer); |
||||
foreach (var value in values) |
||||
{ |
||||
cos.WriteBytes(value); |
||||
} |
||||
cos.Flush(); |
||||
cos.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
[Benchmark] |
||||
[ArgumentsSource(nameof(StringEncodedSizes))] |
||||
public void WriteBytes_WriteContext(int encodedSize) |
||||
{ |
||||
var values = byteStringValues[encodedSize]; |
||||
var span = new Span<byte>(outputBuffer); |
||||
WriteContext.Initialize(ref span, out WriteContext ctx); |
||||
foreach (var value in values) |
||||
{ |
||||
ctx.WriteBytes(value); |
||||
} |
||||
ctx.Flush(); |
||||
ctx.CheckNoSpaceLeft(); |
||||
} |
||||
|
||||
private static uint[] CreateRandomVarints32(Random random, int valueCount, int encodedSize) |
||||
{ |
||||
var result = new uint[valueCount]; |
||||
for (int i = 0; i < valueCount; i++) |
||||
{ |
||||
result[i] = (uint) ParseRawPrimitivesBenchmark.RandomUnsignedVarint(random, encodedSize, true); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
private static ulong[] CreateRandomVarints64(Random random, int valueCount, int encodedSize) |
||||
{ |
||||
var result = new ulong[valueCount]; |
||||
for (int i = 0; i < valueCount; i++) |
||||
{ |
||||
result[i] = ParseRawPrimitivesBenchmark.RandomUnsignedVarint(random, encodedSize, false); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
private static float[] CreateRandomFloats(Random random, int valueCount) |
||||
{ |
||||
var result = new float[valueCount]; |
||||
for (int i = 0; i < valueCount; i++) |
||||
{ |
||||
result[i] = (float)random.NextDouble(); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
private static double[] CreateRandomDoubles(Random random, int valueCount) |
||||
{ |
||||
var result = new double[valueCount]; |
||||
for (int i = 0; i < valueCount; i++) |
||||
{ |
||||
result[i] = random.NextDouble(); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
private static string[] CreateStrings(int valueCount, int encodedSize) |
||||
{ |
||||
var str = ParseRawPrimitivesBenchmark.CreateStringWithEncodedSize(encodedSize); |
||||
|
||||
var result = new string[valueCount]; |
||||
for (int i = 0; i < valueCount; i++) |
||||
{ |
||||
result[i] = str; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
private static string[] CreateNonAsciiStrings(int valueCount, int encodedSize) |
||||
{ |
||||
var str = ParseRawPrimitivesBenchmark.CreateNonAsciiStringWithEncodedSize(encodedSize); |
||||
|
||||
var result = new string[valueCount]; |
||||
for (int i = 0; i < valueCount; i++) |
||||
{ |
||||
result[i] = str; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
private static ByteString[] CreateByteStrings(int valueCount, int encodedSize) |
||||
{ |
||||
var str = ParseRawPrimitivesBenchmark.CreateStringWithEncodedSize(encodedSize); |
||||
|
||||
var result = new ByteString[valueCount]; |
||||
for (int i = 0; i < valueCount; i++) |
||||
{ |
||||
result[i] = ByteString.CopyFrom(Encoding.UTF8.GetBytes(str)); |
||||
} |
||||
return result; |
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue