Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
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
flatbuffers
Commits
e5c21ec6
Commit
e5c21ec6
authored
May 09, 2015
by
rw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
invoke many fewer growth events
parent
e11da87a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
builder.go
go/builder.go
+4
-7
No files found.
go/builder.go
View file @
e5c21ec6
...
...
@@ -34,11 +34,8 @@ func NewBuilder(initialSize int) *Builder {
// Reset truncates the underlying Builder buffer, facilitating alloc-free
// reuse of a Builder.
func
(
b
*
Builder
)
Reset
()
{
b
.
head
=
UOffsetT
(
0
)
b
.
minalign
=
1
if
b
.
Bytes
!=
nil
{
b
.
Bytes
=
b
.
Bytes
[
:
0
]
b
.
Bytes
=
b
.
Bytes
[
:
cap
(
b
.
Bytes
)
]
}
if
b
.
vtables
!=
nil
{
...
...
@@ -48,6 +45,9 @@ func (b *Builder) Reset() {
if
b
.
vtable
!=
nil
{
b
.
vtable
=
b
.
vtable
[
:
0
]
}
b
.
head
=
UOffsetT
(
len
(
b
.
Bytes
))
b
.
minalign
=
1
}
// StartObject initializes bookkeeping for writing a new object.
...
...
@@ -196,9 +196,6 @@ func (b *Builder) growByteBuffer() {
middle
:=
newLen
/
2
copy
(
b
.
Bytes
[
middle
:
],
b
.
Bytes
[
:
middle
])
for
i
:=
0
;
i
<
middle
;
i
++
{
b
.
Bytes
[
i
]
=
0
}
}
// Head gives the start of useful data in the underlying byte buffer.
...
...
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