Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
c86ba1b0
Commit
c86ba1b0
authored
Feb 26, 2018
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X bench-cpu += crc32, adler32
parent
9562304c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
+24
-8
go/neo/t/neotest
go/neo/t/neotest
+6
-3
go/neo/t/tcpu.go
go/neo/t/tcpu.go
+11
-3
go/neo/t/tcpu.py
go/neo/t/tcpu.py
+7
-2
No files found.
go/neo/t/neotest
View file @
c86ba1b0
...
...
@@ -893,9 +893,12 @@ bench_cpu() {
\"
s|^This machine benchmarks at
\(
[0-9.]
\+\)
pystones/second
$|
Benchmark
`
hostname
`
/pystone 1
\1
pystone/s|
\"
"
sizev
=
"1024 4096
$((
2
*
1024
*
1024
))
"
for
size
in
$sizev
;
do
nrun tcpu.py sha1
$size
nrun tcpu_go sha1
$size
benchv
=
"adler32 crc32 sha1"
for
bench
in
$benchv
;
do
for
size
in
$sizev
;
do
nrun tcpu.py
$bench
$size
nrun tcpu_go
$bench
$size
done
done
datav
=
"null-1K null-4K null-2M wczdata prod1-avg prod1-max"
...
...
go/neo/t/tcpu.go
View file @
c86ba1b0
...
...
@@ -27,6 +27,9 @@ import (
"crypto/sha1"
"flag"
"fmt"
"hash"
"hash/adler32"
"hash/crc32"
"io/ioutil"
"log"
"os"
...
...
@@ -79,15 +82,14 @@ func benchit(benchname string, bencharg string, benchf func(*testing.B, string))
}
func
BenchmarkSha1
(
b
*
testing
.
B
,
arg
string
)
{
func
benchHash
(
b
*
testing
.
B
,
h
hash
.
Hash
,
arg
string
)
{
blksize
,
err
:=
strconv
.
Atoi
(
arg
)
if
err
!=
nil
{
b
.
Fatal
(
err
)
}
data
:=
make
([]
byte
,
blksize
)
h
:=
sha1
.
New
()
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
...
...
@@ -95,6 +97,10 @@ func BenchmarkSha1(b *testing.B, arg string) {
}
}
func
BenchmarkAdler32
(
b
*
testing
.
B
,
arg
string
)
{
benchHash
(
b
,
adler32
.
New
(),
arg
)
}
func
BenchmarkCrc32
(
b
*
testing
.
B
,
arg
string
)
{
benchHash
(
b
,
crc32
.
NewIEEE
(),
arg
)
}
func
BenchmarkSha1
(
b
*
testing
.
B
,
arg
string
)
{
benchHash
(
b
,
sha1
.
New
(),
arg
)
}
func
xreadfile
(
t
testing
.
TB
,
path
string
)
[]
byte
{
data
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
!=
nil
{
...
...
@@ -118,6 +124,8 @@ func BenchmarkUnzlib(b *testing.B, zfile string) {
var
benchv
=
map
[
string
]
func
(
*
testing
.
B
,
string
)
{
"adler32"
:
BenchmarkAdler32
,
"crc32"
:
BenchmarkCrc32
,
"sha1"
:
BenchmarkSha1
,
"unzlib"
:
BenchmarkUnzlib
,
}
...
...
go/neo/t/tcpu.py
View file @
c86ba1b0
...
...
@@ -24,6 +24,7 @@ from __future__ import print_function
import
sys
import
hashlib
import
zhash
import
zlib
from
time
import
time
from
math
import
ceil
,
log10
...
...
@@ -111,11 +112,10 @@ def benchit(benchf, bencharg, ttarget = 1.):
# ---- 8< ----
def
bench_sha1
(
b
,
blksize
):
def
_bench_hasher
(
b
,
h
,
blksize
):
blksize
=
int
(
blksize
)
data
=
'
\
0
'
*
blksize
h
=
hashlib
.
sha1
()
b
.
reset_timer
()
n
=
b
.
N
...
...
@@ -125,6 +125,11 @@ def bench_sha1(b, blksize):
i
+=
1
def
bench_adler32
(
b
,
blksize
):
_bench_hasher
(
b
,
zhash
.
Adler32Hasher
(),
blksize
)
def
bench_crc32
(
b
,
blksize
):
_bench_hasher
(
b
,
zhash
.
CRC32Hasher
(),
blksize
)
def
bench_sha1
(
b
,
blksize
):
_bench_hasher
(
b
,
hashlib
.
sha1
(),
blksize
)
def
readfile
(
path
):
with
open
(
path
,
'r'
)
as
f
:
return
f
.
read
()
...
...
Kirill Smelkov
@kirr
mentioned in commit
a60c472c
·
Jul 12, 2018
mentioned in commit
a60c472c
mentioned in commit a60c472c76da315f918afeb06f994c8610cf7c84
Toggle commit list
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