Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
a3767341
Commit
a3767341
authored
Jan 16, 2009
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed benchmark namespace and fixed enum issue
parent
79c72a99
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
145 additions
and
143 deletions
+145
-143
ProtocolBuffers.build
ProtocolBuffers.build
+4
-4
benchmark.proto
protos/google/protobuf/benchmark.proto
+1
-1
benchmark_speed.proto
protos/google/protobuf/benchmark_speed.proto
+1
-1
BenchmarkProtoFile.cs
src/ProtoBench/BenchmarkProtoFile.cs
+52
-52
BenchmarkSpeedProtoFile.cs
src/ProtoBench/BenchmarkSpeedProtoFile.cs
+57
-57
Program.cs
src/ProtoBench/Program.cs
+19
-17
Program.cs
src/ProtoDump/Program.cs
+4
-4
Program.cs
src/ProtoMunge/Program.cs
+4
-5
IMessage.cs
src/ProtocolBuffers/IMessage.cs
+3
-2
No files found.
ProtocolBuffers.build
View file @
a3767341
...
...
@@ -178,13 +178,13 @@
description=
"Runs all performance tests"
>
<exec
program=
"${tools-protobench}"
workingdir=
"${testdata-dir}"
>
<arg
value=
"Google.ProtocolBuffers.
BenchmarkProtos
.Message1,ProtoBench"
/>
<arg
value=
"Google.ProtocolBuffers.
ProtoBench
.Message1,ProtoBench"
/>
<arg
value=
"benchmark_message1.dat"
/>
<arg
value=
"Google.ProtocolBuffers.
BenchmarkProtos
.SpeedMessage1,ProtoBench"
/>
<arg
value=
"Google.ProtocolBuffers.
ProtoBench
.SpeedMessage1,ProtoBench"
/>
<arg
value=
"benchmark_message1.dat"
/>
<arg
value=
"Google.ProtocolBuffers.
BenchmarkProtos
.Message3,ProtoBench"
/>
<arg
value=
"Google.ProtocolBuffers.
ProtoBench
.Message3,ProtoBench"
/>
<arg
value=
"benchmark_message3.dat"
/>
<arg
value=
"Google.ProtocolBuffers.
BenchmarkProtos
.SpeedMessage3,ProtoBench"
/>
<arg
value=
"Google.ProtocolBuffers.
ProtoBench
.SpeedMessage3,ProtoBench"
/>
<arg
value=
"benchmark_message3.dat"
/>
</exec>
</target>
...
...
protos/google/protobuf/benchmark.proto
View file @
a3767341
import
"google/protobuf/csharp_options.proto"
;
option
(
google.protobuf.csharp_file_options
)
.
namespace
=
"Google.ProtocolBuffers.
BenchmarkProtos
"
;
option
(
google.protobuf.csharp_file_options
)
.
namespace
=
"Google.ProtocolBuffers.
ProtoBench
"
;
option
(
google.protobuf.csharp_file_options
)
.
umbrella_classname
=
"BenchmarkProtoFile"
;
package
proto2
.
benchmark.v2_api
;
...
...
protos/google/protobuf/benchmark_speed.proto
View file @
a3767341
import
"google/protobuf/csharp_options.proto"
;
option
(
google.protobuf.csharp_file_options
)
.
namespace
=
"Google.ProtocolBuffers.
BenchmarkProtos
"
;
option
(
google.protobuf.csharp_file_options
)
.
namespace
=
"Google.ProtocolBuffers.
ProtoBench
"
;
option
(
google.protobuf.csharp_file_options
)
.
umbrella_classname
=
"BenchmarkSpeedProtoFile"
;
package
proto2
.
benchmark.v2_api
;
...
...
src/ProtoBench/BenchmarkProtoFile.cs
View file @
a3767341
...
...
@@ -4,7 +4,7 @@ using pb = global::Google.ProtocolBuffers;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
namespace
Google.ProtocolBuffers.
BenchmarkProtos
{
namespace
Google.ProtocolBuffers.
ProtoBench
{
public
static
partial
class
BenchmarkProtoFile
{
...
...
@@ -70,9 +70,9 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
"Eg4KBmZpZWxkMhgCIAEoAhIRCgZmaWVsZDMYAyABKAI6ATASDgoGZmllbGQ0"
+
"GAQgASgIEg4KBmZpZWxkNRgFIAEoCBIUCgZmaWVsZDYYBiABKAg6BHRydWUS"
+
"FQoGZmllbGQ3GAcgASgIOgVmYWxzZRIOCgZmaWVsZDgYCCABKAISDgoGZmll"
+
"bGQ5GAkgASgIEg8KB2ZpZWxkMTAYCiABKAISDwoHZmllbGQxMRgLIAEoA0I
/
"
+
"wj4
8CiZHb29nbGUuUHJvdG9jb2xCdWZmZXJzLkJlbmNobWFya1Byb3RvcxIS
"
+
"
QmVuY2htYXJrUHJvdG9GaWxl
"
),
"bGQ5GAkgASgIEg8KB2ZpZWxkMTAYCiABKAISDwoHZmllbGQxMRgLIAEoA0I
6
"
+
"wj4
3CiFHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlByb3RvQmVuY2gSEkJlbmNo
"
+
"
bWFya1Byb3RvRmlsZQ==
"
),
new
pbd
::
FileDescriptor
[]
{
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
CSharpOptions
.
Descriptor
,
});
...
...
@@ -81,28 +81,28 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
#
region
Static
variables
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_Message1__Descriptor
=
Descriptor
.
MessageTypes
[
0
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message1
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message1__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message1
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message1__Descriptor
,
new
string
[]
{
"Field1"
,
"Field9"
,
"Field18"
,
"Field80"
,
"Field81"
,
"Field2"
,
"Field3"
,
"Field280"
,
"Field6"
,
"Field22"
,
"Field4"
,
"Field5"
,
"Field59"
,
"Field7"
,
"Field16"
,
"Field130"
,
"Field12"
,
"Field17"
,
"Field13"
,
"Field14"
,
"Field104"
,
"Field100"
,
"Field101"
,
"Field102"
,
"Field103"
,
"Field29"
,
"Field30"
,
"Field60"
,
"Field271"
,
"Field272"
,
"Field150"
,
"Field23"
,
"Field24"
,
"Field25"
,
"Field15"
,
"Field78"
,
"Field67"
,
"Field68"
,
"Field128"
,
"Field129"
,
"Field131"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_Message2__Descriptor
=
Descriptor
.
MessageTypes
[
1
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message2__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message2__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message2__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message2__Descriptor
,
new
string
[]
{
"Field1"
,
"Field2"
,
"Field3"
,
"Field15"
,
"Field12"
,
"Field13"
,
"Field14"
,
"Field16"
,
"Field19"
,
"Field20"
,
"Field28"
,
"Field21"
,
"Field22"
,
"Field23"
,
"Field206"
,
"Field203"
,
"Field204"
,
"Field205"
,
"Field207"
,
"Field300"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_Message3__Descriptor
=
Descriptor
.
MessageTypes
[
2
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message3__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message3__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message3__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message3__Descriptor
,
new
string
[]
{
"Field1"
,
"Field3"
,
"Field4"
,
"Field30"
,
"Field75"
,
"Field6"
,
"Field2"
,
"Field21"
,
"Field71"
,
"Field25"
,
"Field109"
,
"Field210"
,
"Field211"
,
"Field212"
,
"Field213"
,
"Field216"
,
"Field217"
,
"Field218"
,
"Field220"
,
"Field221"
,
"Field222"
,
"Field63"
,
"Group1"
,
"Field128"
,
"Field131"
,
"Field127"
,
"Field129"
,
"Field130"
,
"Field205"
,
"Field206"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_Message3_Group1__Descriptor
=
internal__static_proto2_benchmark_v2_api_Message3__Descriptor
.
NestedTypes
[
0
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message3_Group1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message3_Group1__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message3_Group1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message3_Group1__Descriptor
,
new
string
[]
{
"Field11"
,
"Field26"
,
"Field12"
,
"Field13"
,
"Field14"
,
"Field15"
,
"Field5"
,
"Field27"
,
"Field28"
,
"Field29"
,
"Field16"
,
"Field22"
,
"Field73"
,
"Field20"
,
"Field24"
,
"Field31"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_Message4__Descriptor
=
Descriptor
.
MessageTypes
[
3
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message4__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message4__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
Builder
>
internal__static_proto2_benchmark_v2_api_Message4__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
Builder
>(
internal__static_proto2_benchmark_v2_api_Message4__Descriptor
,
new
string
[]
{
"Field1"
,
"Field2"
,
"Field3"
,
"Field4"
,
"Field5"
,
"Field6"
,
"Field7"
,
"Field8"
,
"Field9"
,
"Field10"
,
"Field11"
,
});
#
endregion
}
...
...
@@ -122,11 +122,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message1__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message1__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
Message1
,
Message1
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message1__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message1__FieldAccessorTable
;
}
}
private
bool
hasField1
;
...
...
@@ -438,11 +438,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
private
bool
hasField15
;
private
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
field15_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
.
DefaultInstance
;
private
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
DefaultInstance
;
public
bool
HasField15
{
get
{
return
hasField15
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
Field15
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
Field15
{
get
{
return
field15_
;
}
}
...
...
@@ -1190,24 +1190,24 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
public
bool
HasField15
{
get
{
return
result
.
HasField15
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
Field15
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
Field15
{
get
{
return
result
.
Field15
;
}
set
{
SetField15
(
value
);
}
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
value
)
{
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
value
)
{
result
.
hasField15
=
true
;
result
.
field15_
=
value
;
return
this
;
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
.
Builder
builderForValue
)
{
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
Builder
builderForValue
)
{
result
.
hasField15
=
true
;
result
.
field15_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField15
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
value
)
{
public
Builder
MergeField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
value
)
{
if
(
result
.
HasField15
&&
result
.
field15_
!=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
.
DefaultInstance
)
{
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
.
CreateBuilder
(
result
.
field15_
).
MergeFrom
(
value
).
BuildPartial
();
result
.
field15_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
DefaultInstance
)
{
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
CreateBuilder
(
result
.
field15_
).
MergeFrom
(
value
).
BuildPartial
();
}
else
{
result
.
field15_
=
value
;
}
...
...
@@ -1216,7 +1216,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
Builder
ClearField15
()
{
result
.
hasField15
=
false
;
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message2
.
DefaultInstance
;
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
DefaultInstance
;
return
this
;
}
...
...
@@ -1345,11 +1345,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message2__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message2__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
Message2
,
Message2
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message2__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message2__FieldAccessorTable
;
}
}
private
bool
hasField1
;
...
...
@@ -1975,11 +1975,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
Message3
,
Message3
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3__FieldAccessorTable
;
}
}
#
region
Nested
types
...
...
@@ -1999,11 +1999,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3_Group1__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3_Group1__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
Group1
,
Group1
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3_Group1__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message3_Group1__FieldAccessorTable
;
}
}
private
bool
hasField11
;
...
...
@@ -2148,11 +2148,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
private
bool
hasField31
;
private
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
field31_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
.
DefaultInstance
;
private
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
DefaultInstance
;
public
bool
HasField31
{
get
{
return
hasField31
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
Field31
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
Field31
{
get
{
return
field31_
;
}
}
...
...
@@ -2522,24 +2522,24 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
public
bool
HasField31
{
get
{
return
result
.
HasField31
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
Field31
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
Field31
{
get
{
return
result
.
Field31
;
}
set
{
SetField31
(
value
);
}
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
value
)
{
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
value
)
{
result
.
hasField31
=
true
;
result
.
field31_
=
value
;
return
this
;
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
.
Builder
builderForValue
)
{
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
Builder
builderForValue
)
{
result
.
hasField31
=
true
;
result
.
field31_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField31
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
value
)
{
public
Builder
MergeField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
value
)
{
if
(
result
.
HasField31
&&
result
.
field31_
!=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
.
DefaultInstance
)
{
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
.
CreateBuilder
(
result
.
field31_
).
MergeFrom
(
value
).
BuildPartial
();
result
.
field31_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
DefaultInstance
)
{
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
CreateBuilder
(
result
.
field31_
).
MergeFrom
(
value
).
BuildPartial
();
}
else
{
result
.
field31_
=
value
;
}
...
...
@@ -2548,7 +2548,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
Builder
ClearField31
()
{
result
.
hasField31
=
false
;
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message4
.
DefaultInstance
;
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
DefaultInstance
;
return
this
;
}
}
...
...
@@ -2755,14 +2755,14 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
get
{
return
field63_
;
}
}
private
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
>
group1_
=
new
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
>();
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
>
Group1List
{
private
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
>
group1_
=
new
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
>();
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
>
Group1List
{
get
{
return
group1_
;
}
}
public
int
Group1Count
{
get
{
return
group1_
.
Count
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
return
group1_
[
index
];
}
...
...
@@ -3301,32 +3301,32 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
return
this
;
}
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
>
Group1List
{
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
>
Group1List
{
get
{
return
result
.
group1_
;
}
}
public
int
Group1Count
{
get
{
return
result
.
Group1Count
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
return
result
.
GetGroup1
(
index
);
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
value
)
{
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
value
)
{
result
.
group1_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
.
Builder
builderForValue
)
{
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
.
Builder
builderForValue
)
{
result
.
group1_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
value
)
{
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
value
)
{
result
.
group1_
.
Add
(
value
);
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
.
Builder
builderForValue
)
{
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
.
Builder
builderForValue
)
{
result
.
group1_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
public
Builder
AddRangeGroup1
(
scg
::
IEnumerable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
Message3
.
Types
.
Group1
>
values
)
{
public
Builder
AddRangeGroup1
(
scg
::
IEnumerable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
>
values
)
{
base
.
AddRange
(
values
,
result
.
group1_
);
return
this
;
}
...
...
@@ -3502,11 +3502,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message4__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message4__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
Message4
,
Message4
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message4__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkProtoFile
.
internal__static_proto2_benchmark_v2_api_Message4__FieldAccessorTable
;
}
}
private
bool
hasField1
;
...
...
src/ProtoBench/BenchmarkSpeedProtoFile.cs
View file @
a3767341
...
...
@@ -4,7 +4,7 @@ using pb = global::Google.ProtocolBuffers;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
namespace
Google.ProtocolBuffers.
BenchmarkProtos
{
namespace
Google.ProtocolBuffers.
ProtoBench
{
public
static
partial
class
BenchmarkSpeedProtoFile
{
...
...
@@ -71,9 +71,9 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
"ZmllbGQyGAIgASgCEhEKBmZpZWxkMxgDIAEoAjoBMBIOCgZmaWVsZDQYBCAB"
+
"KAgSDgoGZmllbGQ1GAUgASgIEhQKBmZpZWxkNhgGIAEoCDoEdHJ1ZRIVCgZm"
+
"aWVsZDcYByABKAg6BWZhbHNlEg4KBmZpZWxkOBgIIAEoAhIOCgZmaWVsZDkY"
+
"CSABKAgSDwoHZmllbGQxMBgKIAEoAhIPCgdmaWVsZDExGAsgASgDQk
Z
IAcI+"
+
"
QQomR29vZ2xlLlByb3RvY29sQnVmZmVycy5CZW5jaG1hcmtQcm90b3MSF0Jl
"
+
"
bmNobWFya1NwZWVkUHJvdG9GaWxl
"
),
"CSABKAgSDwoHZmllbGQxMBgKIAEoAhIPCgdmaWVsZDExGAsgASgDQk
F
IAcI+"
+
"
PAohR29vZ2xlLlByb3RvY29sQnVmZmVycy5Qcm90b0JlbmNoEhdCZW5jaG1h
"
+
"
cmtTcGVlZFByb3RvRmlsZQ==
"
),
new
pbd
::
FileDescriptor
[]
{
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
CSharpOptions
.
Descriptor
,
});
...
...
@@ -82,28 +82,28 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
#
region
Static
variables
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_SpeedMessage1__Descriptor
=
Descriptor
.
MessageTypes
[
0
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage1
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage1__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage1
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage1__Descriptor
,
new
string
[]
{
"Field1"
,
"Field9"
,
"Field18"
,
"Field80"
,
"Field81"
,
"Field2"
,
"Field3"
,
"Field280"
,
"Field6"
,
"Field22"
,
"Field4"
,
"Field5"
,
"Field59"
,
"Field7"
,
"Field16"
,
"Field130"
,
"Field12"
,
"Field17"
,
"Field13"
,
"Field14"
,
"Field104"
,
"Field100"
,
"Field101"
,
"Field102"
,
"Field103"
,
"Field29"
,
"Field30"
,
"Field60"
,
"Field271"
,
"Field272"
,
"Field150"
,
"Field23"
,
"Field24"
,
"Field25"
,
"Field15"
,
"Field78"
,
"Field67"
,
"Field68"
,
"Field128"
,
"Field129"
,
"Field131"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_SpeedMessage2__Descriptor
=
Descriptor
.
MessageTypes
[
1
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage2__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage2__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage2__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage2__Descriptor
,
new
string
[]
{
"Field1"
,
"Field2"
,
"Field3"
,
"Field15"
,
"Field12"
,
"Field13"
,
"Field14"
,
"Field16"
,
"Field19"
,
"Field20"
,
"Field28"
,
"Field21"
,
"Field22"
,
"Field23"
,
"Field206"
,
"Field203"
,
"Field204"
,
"Field205"
,
"Field207"
,
"Field300"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_SpeedMessage3__Descriptor
=
Descriptor
.
MessageTypes
[
2
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage3__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage3__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage3__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage3__Descriptor
,
new
string
[]
{
"Field1"
,
"Field3"
,
"Field4"
,
"Field30"
,
"Field75"
,
"Field6"
,
"Field2"
,
"Field21"
,
"Field71"
,
"Field25"
,
"Field109"
,
"Field210"
,
"Field211"
,
"Field212"
,
"Field213"
,
"Field216"
,
"Field217"
,
"Field218"
,
"Field220"
,
"Field221"
,
"Field222"
,
"Field63"
,
"Group1"
,
"Field128"
,
"Field131"
,
"Field127"
,
"Field129"
,
"Field130"
,
"Field205"
,
"Field206"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__Descriptor
=
internal__static_proto2_benchmark_v2_api_SpeedMessage3__Descriptor
.
NestedTypes
[
0
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__Descriptor
,
new
string
[]
{
"Field11"
,
"Field26"
,
"Field12"
,
"Field13"
,
"Field14"
,
"Field15"
,
"Field5"
,
"Field27"
,
"Field28"
,
"Field29"
,
"Field16"
,
"Field22"
,
"Field73"
,
"Field20"
,
"Field24"
,
"Field31"
,
});
internal
static
readonly
pbd
::
MessageDescriptor
internal__static_proto2_benchmark_v2_api_SpeedMessage4__Descriptor
=
Descriptor
.
MessageTypes
[
3
];
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage4__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage4__Descriptor
,
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
Builder
>
internal__static_proto2_benchmark_v2_api_SpeedMessage4__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
Builder
>(
internal__static_proto2_benchmark_v2_api_SpeedMessage4__Descriptor
,
new
string
[]
{
"Field1"
,
"Field2"
,
"Field3"
,
"Field4"
,
"Field5"
,
"Field6"
,
"Field7"
,
"Field8"
,
"Field9"
,
"Field10"
,
"Field11"
,
});
#
endregion
}
...
...
@@ -123,11 +123,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage1__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage1__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
SpeedMessage1
,
SpeedMessage1
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage1__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage1__FieldAccessorTable
;
}
}
private
bool
hasField1
;
...
...
@@ -439,11 +439,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
private
bool
hasField15
;
private
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
field15_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
DefaultInstance
;
private
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
DefaultInstance
;
public
bool
HasField15
{
get
{
return
hasField15
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
Field15
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
Field15
{
get
{
return
field15_
;
}
}
...
...
@@ -1042,7 +1042,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
break
;
}
case
122
:
{
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
Builder
subBuilder
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
CreateBuilder
();
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
Builder
subBuilder
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
CreateBuilder
();
if
(
HasField15
)
{
subBuilder
.
MergeFrom
(
Field15
);
}
...
...
@@ -1794,24 +1794,24 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
public
bool
HasField15
{
get
{
return
result
.
HasField15
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
Field15
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
Field15
{
get
{
return
result
.
Field15
;
}
set
{
SetField15
(
value
);
}
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
value
)
{
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
value
)
{
result
.
hasField15
=
true
;
result
.
field15_
=
value
;
return
this
;
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
Builder
builderForValue
)
{
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
Builder
builderForValue
)
{
result
.
hasField15
=
true
;
result
.
field15_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField15
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
value
)
{
public
Builder
MergeField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
value
)
{
if
(
result
.
HasField15
&&
result
.
field15_
!=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
DefaultInstance
)
{
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
CreateBuilder
(
result
.
field15_
).
MergeFrom
(
value
).
BuildPartial
();
result
.
field15_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
DefaultInstance
)
{
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
CreateBuilder
(
result
.
field15_
).
MergeFrom
(
value
).
BuildPartial
();
}
else
{
result
.
field15_
=
value
;
}
...
...
@@ -1820,7 +1820,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
Builder
ClearField15
()
{
result
.
hasField15
=
false
;
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage2
.
DefaultInstance
;
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
DefaultInstance
;
return
this
;
}
...
...
@@ -1949,11 +1949,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage2__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage2__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
SpeedMessage2
,
SpeedMessage2
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage2__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage2__FieldAccessorTable
;
}
}
private
bool
hasField1
;
...
...
@@ -2901,11 +2901,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
SpeedMessage3
,
SpeedMessage3
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3__FieldAccessorTable
;
}
}
#
region
Nested
types
...
...
@@ -2925,11 +2925,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
Group1
,
Group1
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage3_Group1__FieldAccessorTable
;
}
}
private
bool
hasField11
;
...
...
@@ -3074,11 +3074,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
private
bool
hasField31
;
private
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
field31_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
DefaultInstance
;
private
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
DefaultInstance
;
public
bool
HasField31
{
get
{
return
hasField31
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
Field31
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
Field31
{
get
{
return
field31_
;
}
}
...
...
@@ -3411,7 +3411,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
break
;
}
case
250
:
{
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
Builder
subBuilder
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
CreateBuilder
();
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
Builder
subBuilder
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
CreateBuilder
();
if
(
HasField31
)
{
subBuilder
.
MergeFrom
(
Field31
);
}
...
...
@@ -3725,24 +3725,24 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
public
bool
HasField31
{
get
{
return
result
.
HasField31
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
Field31
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
Field31
{
get
{
return
result
.
Field31
;
}
set
{
SetField31
(
value
);
}
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
value
)
{
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
value
)
{
result
.
hasField31
=
true
;
result
.
field31_
=
value
;
return
this
;
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
Builder
builderForValue
)
{
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
Builder
builderForValue
)
{
result
.
hasField31
=
true
;
result
.
field31_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField31
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
value
)
{
public
Builder
MergeField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
value
)
{
if
(
result
.
HasField31
&&
result
.
field31_
!=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
DefaultInstance
)
{
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
CreateBuilder
(
result
.
field31_
).
MergeFrom
(
value
).
BuildPartial
();
result
.
field31_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
DefaultInstance
)
{
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
CreateBuilder
(
result
.
field31_
).
MergeFrom
(
value
).
BuildPartial
();
}
else
{
result
.
field31_
=
value
;
}
...
...
@@ -3751,7 +3751,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
Builder
ClearField31
()
{
result
.
hasField31
=
false
;
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage4
.
DefaultInstance
;
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
DefaultInstance
;
return
this
;
}
}
...
...
@@ -3958,14 +3958,14 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
get
{
return
field63_
;
}
}
private
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
>
group1_
=
new
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
>();
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
>
Group1List
{
private
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
>
group1_
=
new
pbc
::
PopsicleList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
>();
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
>
Group1List
{
get
{
return
group1_
;
}
}
public
int
Group1Count
{
get
{
return
group1_
.
Count
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
return
group1_
[
index
];
}
...
...
@@ -4060,7 +4060,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
if
(
HasField6
)
{
output
.
WriteString
(
6
,
Field6
);
}
foreach
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
element
in
Group1List
)
{
foreach
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
element
in
Group1List
)
{
output
.
WriteGroup
(
10
,
element
);
}
if
(
HasField21
)
{
...
...
@@ -4211,7 +4211,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
if
(
HasField63
)
{
size
+=
pb
::
CodedOutputStream
.
ComputeInt32Size
(
63
,
Field63
);
}
foreach
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
element
in
Group1List
)
{
foreach
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
element
in
Group1List
)
{
size
+=
pb
::
CodedOutputStream
.
ComputeGroupSize
(
10
,
element
);
}
foreach
(
string
element
in
Field128List
)
{
...
...
@@ -4456,7 +4456,7 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
break
;
}
case
83
:
{
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
.
Builder
subBuilder
=
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
.
CreateBuilder
();
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
Builder
subBuilder
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
CreateBuilder
();
input
.
ReadGroup
(
10
,
subBuilder
,
extensionRegistry
);
AddGroup1
(
subBuilder
.
BuildPartial
());
break
;
...
...
@@ -4958,32 +4958,32 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
return
this
;
}
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
>
Group1List
{
public
scg
::
IList
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
>
Group1List
{
get
{
return
result
.
group1_
;
}
}
public
int
Group1Count
{
get
{
return
result
.
Group1Count
;
}
}
public
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
public
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
GetGroup1
(
int
index
)
{
return
result
.
GetGroup1
(
index
);
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
value
)
{
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
value
)
{
result
.
group1_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
.
Builder
builderForValue
)
{
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
Builder
builderForValue
)
{
result
.
group1_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
value
)
{
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
value
)
{
result
.
group1_
.
Add
(
value
);
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
.
Builder
builderForValue
)
{
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
Builder
builderForValue
)
{
result
.
group1_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
public
Builder
AddRangeGroup1
(
scg
::
IEnumerable
<
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
SpeedMessage3
.
Types
.
Group1
>
values
)
{
public
Builder
AddRangeGroup1
(
scg
::
IEnumerable
<
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
>
values
)
{
base
.
AddRange
(
values
,
result
.
group1_
);
return
this
;
}
...
...
@@ -5159,11 +5159,11 @@ namespace Google.ProtocolBuffers.BenchmarkProtos {
}
public
static
pbd
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage4__Descriptor
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage4__Descriptor
;
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
SpeedMessage4
,
SpeedMessage4
.
Builder
>
InternalFieldAccessors
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
BenchmarkProtos
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage4__FieldAccessorTable
;
}
get
{
return
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
BenchmarkSpeedProtoFile
.
internal__static_proto2_benchmark_v2_api_SpeedMessage4__FieldAccessorTable
;
}
}
private
bool
hasField1
;
...
...
src/ProtoBench/Program.cs
View file @
a3767341
using
System
;
using
System.Diagnostics
;
using
System.IO
;
using
Google.ProtocolBuffers
;
namespace
ProtoBench
{
namespace
Google.ProtocolBuffers.ProtoBench
{
/// <summary>
/// Simple benchmarking of arbitrary messages.
/// </summary>
...
...
@@ -52,21 +52,22 @@ namespace ProtoBench {
Benchmark
(
"Serialize to byte string"
,
inputData
.
Length
,
()
=>
sampleMessage
.
ToByteString
());
Benchmark
(
"Serialize to byte array"
,
inputData
.
Length
,
()
=>
sampleMessage
.
ToByteArray
());
Benchmark
(
"Serialize to memory stream"
,
inputData
.
Length
,
()
=>
sampleMessage
.
WriteTo
(
new
MemoryStream
()));
Benchmark
(
"Deserialize from byte string"
,
inputData
.
Length
,
()
=>
defaultMessage
.
WeakCreateBuilderForType
()
.
WeakMergeFrom
(
inputString
)
.
WeakBuild
()
Benchmark
(
"Deserialize from byte string"
,
inputData
.
Length
,
()
=>
defaultMessage
.
WeakCreateBuilderForType
()
.
WeakMergeFrom
(
inputString
)
.
WeakBuild
()
);
Benchmark
(
"Deserialize from byte array"
,
inputData
.
Length
,
()
=>
defaultMessage
.
WeakCreateBuilderForType
()
.
WeakMergeFrom
(
CodedInputStream
.
CreateInstance
(
inputData
))
.
WeakBuild
()
Benchmark
(
"Deserialize from byte array"
,
inputData
.
Length
,
()
=>
defaultMessage
.
WeakCreateBuilderForType
()
.
WeakMergeFrom
(
CodedInputStream
.
CreateInstance
(
inputData
))
.
WeakBuild
()
);
Benchmark
(
"Deserialize from memory stream"
,
inputData
.
Length
,
()
=>
Benchmark
(
"Deserialize from memory stream"
,
inputData
.
Length
,
()
=>
{
inputStream
.
Position
=
0
;
defaultMessage
.
WeakCreateBuilderForType
()
.
WeakMergeFrom
(
CodedInputStream
.
CreateInstance
(
inputStream
))
.
WeakBuild
()
);
.
WeakMergeFrom
(
CodedInputStream
.
CreateInstance
(
inputStream
))
.
WeakBuild
();
}
);
return
true
;
}
catch
(
Exception
e
)
{
Console
.
Error
.
WriteLine
(
"Error: {0}"
,
e
.
Message
);
...
...
@@ -92,8 +93,8 @@ namespace ProtoBench {
iterations
=
(
int
)
((
TargetTime
.
Ticks
/
(
double
)
elapsed
.
Ticks
)
*
iterations
);
elapsed
=
TimeAction
(
action
,
iterations
);
Console
.
WriteLine
(
"{0}: {1} iterations in {2:f3}s; {3:f3}MB/s"
,
name
,
iterations
,
elapsed
.
TotalSeconds
,
(
iterations
*
dataSize
)
/
(
elapsed
.
TotalSeconds
*
1024
*
1024
));
name
,
iterations
,
elapsed
.
TotalSeconds
,
(
iterations
*
dataSize
)
/
(
elapsed
.
TotalSeconds
*
1024
*
1024
));
}
private
static
TimeSpan
TimeAction
(
Action
action
,
int
iterations
)
{
...
...
@@ -105,4 +106,4 @@ namespace ProtoBench {
return
sw
.
Elapsed
;
}
}
}
}
\ No newline at end of file
src/ProtoDump/Program.cs
View file @
a3767341
using
System
;
using
System.IO
;
using
System.Reflection
;
using
Google.ProtocolBuffers
;
namespace
ProtoDump
{
namespace
Google.ProtocolBuffers.ProtoDump
{
/// <summary>
/// Small utility to load a binary message and dump it in text form
/// </summary>
...
...
@@ -40,4 +39,4 @@ namespace ProtoDump {
}
}
}
}
}
\ No newline at end of file
src/ProtoMunge/Program.cs
View file @
a3767341
...
...
@@ -2,7 +2,6 @@
using
System.Collections
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Reflection
;
using
Google.ProtocolBuffers.Descriptors
;
namespace
Google.ProtocolBuffers.ProtoMunge
...
...
@@ -143,7 +142,7 @@ namespace Google.ProtocolBuffers.ProtoMunge
return
BitConverter
.
ToInt32
(
data
,
0
);
}
case
FieldType
.
Enum
:
return
MungeEnum
(
fieldDescriptor
,
(
int
)
value
);
return
MungeEnum
(
fieldDescriptor
,
(
EnumValueDescriptor
)
value
);
default
:
// TODO(jonskeet): Different exception?
throw
new
ArgumentException
(
"Invalid field descriptor"
);
...
...
@@ -207,16 +206,16 @@ namespace Google.ProtocolBuffers.ProtoMunge
return
min
+
(
ulong
)(
range
*
rng
.
NextDouble
());
}
private
static
object
MungeEnum
(
FieldDescriptor
fieldDescriptor
,
int
original
)
{
private
static
object
MungeEnum
(
FieldDescriptor
fieldDescriptor
,
EnumValueDescriptor
original
)
{
// Find all the values which get encoded to the same size as the current value, and pick one at random
int
originalSize
=
CodedOutputStream
.
ComputeRawVarint32Size
((
uint
)
original
);
int
originalSize
=
CodedOutputStream
.
ComputeRawVarint32Size
((
uint
)
original
.
Number
);
List
<
EnumValueDescriptor
>
sameSizeValues
=
new
List
<
EnumValueDescriptor
>
();
foreach
(
EnumValueDescriptor
candidate
in
fieldDescriptor
.
EnumType
.
Values
)
{
if
(
CodedOutputStream
.
ComputeRawVarint32Size
((
uint
)
candidate
.
Number
)
==
originalSize
)
{
sameSizeValues
.
Add
(
candidate
);
}
}
return
sameSizeValues
[
rng
.
Next
(
sameSizeValues
.
Count
)]
.
Number
;
return
sameSizeValues
[
rng
.
Next
(
sameSizeValues
.
Count
)];
}
private
static
object
MungeByteString
(
ByteString
byteString
)
{
...
...
src/ProtocolBuffers/IMessage.cs
View file @
a3767341
...
...
@@ -88,8 +88,9 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Gets an element of a repeated field. For value type fields
/// including enums, the boxed value is returned. For embedded
/// message fields, the sub-message is returned.
/// excluding enums, the boxed value is returned. For embedded
/// message fields, the sub-message is returned. For enums, the
/// relevant EnumValueDescriptor is returned.
/// </summary>
/// <exception cref="ArgumentException">the field is not a repeated field,
/// or it's not a field of this type</exception>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment