Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-buffer-pool
Commits
0081fc69
Commit
0081fc69
authored
May 21, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmark against alloc
parent
8af23348
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
pool_test.go
pool_test.go
+16
-0
No files found.
pool_test.go
View file @
0081fc69
...
...
@@ -139,11 +139,27 @@ func BenchmarkPool(b *testing.B) {
i
=
i
<<
1
}
b
:=
p
.
Get
(
i
)
b
[
0
]
=
byte
(
i
)
p
.
Put
(
b
)
}
})
}
func
BenchmarkAlloc
(
b
*
testing
.
B
)
{
b
.
RunParallel
(
func
(
pb
*
testing
.
PB
)
{
i
:=
7
for
pb
.
Next
()
{
if
i
>
1
<<
20
{
i
=
7
}
else
{
i
=
i
<<
1
}
b
:=
make
([]
byte
,
i
)
b
[
1
]
=
byte
(
i
)
}
})
}
func
BenchmarkPoolOverlflow
(
b
*
testing
.
B
)
{
var
p
BufferPool
b
.
RunParallel
(
func
(
pb
*
testing
.
PB
)
{
...
...
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