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
6f9da37b
Commit
6f9da37b
authored
May 07, 2015
by
Jan Tattermusch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Performance optimization for small messages without unknown fields
parent
e0afc002
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
UnknownFieldSet.cs
csharp/src/ProtocolBuffers/UnknownFieldSet.cs
+20
-0
No files found.
csharp/src/ProtocolBuffers/UnknownFieldSet.cs
View file @
6f9da37b
...
...
@@ -124,12 +124,16 @@ namespace Google.ProtocolBuffers
/// Serializes the set and writes it to <paramref name="output"/>.
/// </summary>
public
void
WriteTo
(
ICodedOutputStream
output
)
{
// Avoid creating enumerator for the most common code path.
if
(
fields
.
Count
>
0
)
{
foreach
(
KeyValuePair
<
int
,
UnknownField
>
entry
in
fields
)
{
entry
.
Value
.
WriteTo
(
entry
.
Key
,
output
);
}
}
}
/// <summary>
/// Gets the number of bytes required to encode this set.
...
...
@@ -138,6 +142,12 @@ namespace Google.ProtocolBuffers
{
get
{
// Avoid creating enumerator for the most common code path.
if
(
fields
.
Count
==
0
)
{
return
0
;
}
int
result
=
0
;
foreach
(
KeyValuePair
<
int
,
UnknownField
>
entry
in
fields
)
{
...
...
@@ -208,12 +218,16 @@ namespace Google.ProtocolBuffers
/// the MessageSet wire format.
/// </summary>
public
void
WriteAsMessageSetTo
(
ICodedOutputStream
output
)
{
// Avoid creating enumerator for the most common code path.
if
(
fields
.
Count
>
0
)
{
foreach
(
KeyValuePair
<
int
,
UnknownField
>
entry
in
fields
)
{
entry
.
Value
.
WriteAsMessageSetExtensionTo
(
entry
.
Key
,
output
);
}
}
}
/// <summary>
/// Gets the number of bytes required to encode this set using the MessageSet
...
...
@@ -223,6 +237,12 @@ namespace Google.ProtocolBuffers
{
get
{
// Avoid creating enumerator for the most common code path.
if
(
fields
.
Count
==
0
)
{
return
0
;
}
int
result
=
0
;
foreach
(
KeyValuePair
<
int
,
UnknownField
>
entry
in
fields
)
{
...
...
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