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
dms3
go-dms3
Commits
61b47340
Commit
61b47340
authored
Apr 28, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a benchmark for our hash function
parent
ff1e58a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
util/util_test.go
util/util_test.go
+30
-0
No files found.
util/util_test.go
View file @
61b47340
...
...
@@ -53,3 +53,33 @@ func TestXOR(t *testing.T) {
}
}
}
func
BenchmarkHash256K
(
b
*
testing
.
B
)
{
buf
:=
make
([]
byte
,
256
*
1024
)
NewTimeSeededRand
()
.
Read
(
buf
)
b
.
SetBytes
(
int64
(
256
*
1024
))
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
Hash
(
buf
)
}
}
func
BenchmarkHash512K
(
b
*
testing
.
B
)
{
buf
:=
make
([]
byte
,
512
*
1024
)
NewTimeSeededRand
()
.
Read
(
buf
)
b
.
SetBytes
(
int64
(
512
*
1024
))
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
Hash
(
buf
)
}
}
func
BenchmarkHash1M
(
b
*
testing
.
B
)
{
buf
:=
make
([]
byte
,
1024
*
1024
)
NewTimeSeededRand
()
.
Read
(
buf
)
b
.
SetBytes
(
int64
(
1024
*
1024
))
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
Hash
(
buf
)
}
}
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