Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-flatbuffers
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-flatbuffers
Commits
be11d2b6
Commit
be11d2b6
authored
9 years ago
by
Oli Wilkinson
Browse files
Options
Downloads
Patches
Plain Diff
C# performance optimization to Pad/Prep methods
parent
b8187e5b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
net/FlatBuffers/ByteBuffer.cs
+7
-0
7 additions, 0 deletions
net/FlatBuffers/ByteBuffer.cs
net/FlatBuffers/FlatBufferBuilder.cs
+3
-5
3 additions, 5 deletions
net/FlatBuffers/FlatBufferBuilder.cs
with
10 additions
and
5 deletions
net/FlatBuffers/ByteBuffer.cs
+
7
−
0
View file @
be11d2b6
...
...
@@ -146,6 +146,13 @@ namespace FlatBuffers
_buffer
[
offset
]
=
value
;
}
public
void
PutByte
(
int
offset
,
byte
value
,
int
count
)
{
AssertOffsetAndLength
(
offset
,
sizeof
(
byte
)
*
count
);
for
(
var
i
=
0
;
i
<
count
;
++
i
)
_buffer
[
offset
+
i
]
=
value
;
}
// this method exists in order to conform with Java ByteBuffer standards
public
void
Put
(
int
offset
,
byte
value
)
{
...
...
This diff is collapsed.
Click to expand it.
net/FlatBuffers/FlatBufferBuilder.cs
+
3
−
5
View file @
be11d2b6
...
...
@@ -69,10 +69,7 @@ namespace FlatBuffers
public
void
Pad
(
int
size
)
{
for
(
var
i
=
0
;
i
<
size
;
i
++)
{
_bb
.
PutByte
(--
_space
,
0
);
}
_bb
.
PutByte
(
_space
-=
size
,
0
,
size
);
}
// Doubles the size of the ByteBuffer, and copies the old data towards
...
...
@@ -116,7 +113,8 @@ namespace FlatBuffers
_space
+=
(
int
)
_bb
.
Length
-
oldBufSize
;
}
Pad
(
alignSize
);
if
(
alignSize
>
0
)
Pad
(
alignSize
);
}
public
void
PutBool
(
bool
x
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment