Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
c86ba1b0
Commit
c86ba1b0
authored
Feb 26, 2018
by
Kirill Smelkov
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() {
...
@@ -893,9 +893,12 @@ bench_cpu() {
\"
s|^This machine benchmarks at
\(
[0-9.]
\+\)
pystones/second
$|
Benchmark
`
hostname
`
/pystone 1
\1
pystone/s|
\"
"
\"
s|^This machine benchmarks at
\(
[0-9.]
\+\)
pystones/second
$|
Benchmark
`
hostname
`
/pystone 1
\1
pystone/s|
\"
"
sizev
=
"1024 4096
$((
2
*
1024
*
1024
))
"
sizev
=
"1024 4096
$((
2
*
1024
*
1024
))
"
for
size
in
$sizev
;
do
benchv
=
"adler32 crc32 sha1"
nrun tcpu.py sha1
$size
for
bench
in
$benchv
;
do
nrun tcpu_go sha1
$size
for
size
in
$sizev
;
do
nrun tcpu.py
$bench
$size
nrun tcpu_go
$bench
$size
done
done
done
datav
=
"null-1K null-4K null-2M wczdata prod1-avg prod1-max"
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 (
...
@@ -27,6 +27,9 @@ import (
"crypto/sha1"
"crypto/sha1"
"flag"
"flag"
"fmt"
"fmt"
"hash"
"hash/adler32"
"hash/crc32"
"io/ioutil"
"io/ioutil"
"log"
"log"
"os"
"os"
...
@@ -79,15 +82,14 @@ func benchit(benchname string, bencharg string, benchf func(*testing.B, string))
...
@@ -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
)
blksize
,
err
:=
strconv
.
Atoi
(
arg
)
if
err
!=
nil
{
if
err
!=
nil
{
b
.
Fatal
(
err
)
b
.
Fatal
(
err
)
}
}
data
:=
make
([]
byte
,
blksize
)
data
:=
make
([]
byte
,
blksize
)
h
:=
sha1
.
New
()
b
.
ResetTimer
()
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
...
@@ -95,6 +97,10 @@ func BenchmarkSha1(b *testing.B, arg string) {
...
@@ -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
{
func
xreadfile
(
t
testing
.
TB
,
path
string
)
[]
byte
{
data
,
err
:=
ioutil
.
ReadFile
(
path
)
data
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -118,6 +124,8 @@ func BenchmarkUnzlib(b *testing.B, zfile string) {
...
@@ -118,6 +124,8 @@ func BenchmarkUnzlib(b *testing.B, zfile string) {
var
benchv
=
map
[
string
]
func
(
*
testing
.
B
,
string
)
{
var
benchv
=
map
[
string
]
func
(
*
testing
.
B
,
string
)
{
"adler32"
:
BenchmarkAdler32
,
"crc32"
:
BenchmarkCrc32
,
"sha1"
:
BenchmarkSha1
,
"sha1"
:
BenchmarkSha1
,
"unzlib"
:
BenchmarkUnzlib
,
"unzlib"
:
BenchmarkUnzlib
,
}
}
...
...
go/neo/t/tcpu.py
View file @
c86ba1b0
...
@@ -24,6 +24,7 @@ from __future__ import print_function
...
@@ -24,6 +24,7 @@ from __future__ import print_function
import
sys
import
sys
import
hashlib
import
hashlib
import
zhash
import
zlib
import
zlib
from
time
import
time
from
time
import
time
from
math
import
ceil
,
log10
from
math
import
ceil
,
log10
...
@@ -111,11 +112,10 @@ def benchit(benchf, bencharg, ttarget = 1.):
...
@@ -111,11 +112,10 @@ def benchit(benchf, bencharg, ttarget = 1.):
# ---- 8< ----
# ---- 8< ----
def
bench_sha1
(
b
,
blksize
):
def
_bench_hasher
(
b
,
h
,
blksize
):
blksize
=
int
(
blksize
)
blksize
=
int
(
blksize
)
data
=
'
\
0
'
*
blksize
data
=
'
\
0
'
*
blksize
h
=
hashlib
.
sha1
()
b
.
reset_timer
()
b
.
reset_timer
()
n
=
b
.
N
n
=
b
.
N
...
@@ -125,6 +125,11 @@ def bench_sha1(b, blksize):
...
@@ -125,6 +125,11 @@ def bench_sha1(b, blksize):
i
+=
1
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
):
def
readfile
(
path
):
with
open
(
path
,
'r'
)
as
f
:
with
open
(
path
,
'r'
)
as
f
:
return
f
.
read
()
return
f
.
read
()
...
...
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