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
9a266d11
Commit
9a266d11
authored
Dec 13, 2017
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X neotest/bench-cpu: Also benchmark sha1 for 2M; report size units as e.g. 4K not 4096B
parent
44529dbf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
6 deletions
+33
-6
go/neo/t/neotest
go/neo/t/neotest
+5
-4
go/neo/t/tsha1.go
go/neo/t/tsha1.go
+15
-1
go/neo/t/tsha1.py
go/neo/t/tsha1.py
+13
-1
No files found.
go/neo/t/neotest
View file @
9a266d11
...
...
@@ -846,10 +846,11 @@ bench_cpu() {
nrun sh
-c
"python -m test.pystone |tail -1 |sed -e
\
\"
s|^This machine benchmarks at
\(
[0-9.]
\+\)
pystones/second
$|
Benchmark
`
hostname
`
/pystone 1
\1
pystone/s|
\"
"
nrun tsha1.py 1024
nrun tsha1_go 1024
nrun tsha1.py 4096
nrun tsha1_go 4096
sizev
=
"1024 4096
$((
2
*
1024
*
1024
))
"
for
size
in
$sizev
;
do
nrun tsha1.py
$size
nrun tsha1_go
$size
done
}
# bench_disk - benchmark direct (uncached) and cached random reads
...
...
go/neo/t/tsha1.go
View file @
9a266d11
...
...
@@ -36,6 +36,20 @@ func dieusage() {
os
.
Exit
(
1
)
}
const
unitv
=
"BKMGT"
// (2^10)^i represents by corresponding char suffix
// fmtsize formats size in human readable form
func
fmtsize
(
size
int
)
string
{
const
order
=
1
<<
10
norder
:=
0
for
size
!=
0
&&
(
size
%
order
)
==
0
&&
(
norder
+
1
<
len
(
unitv
))
{
size
/=
order
norder
+=
1
}
return
fmt
.
Sprintf
(
"%d%c"
,
size
,
unitv
[
norder
])
}
func
main
()
{
if
len
(
os
.
Args
)
!=
2
{
dieusage
()
...
...
@@ -67,5 +81,5 @@ func main() {
hostname
=
"?"
}
fmt
.
Printf
(
"Benchmark%s/sha1/go/%
dB %d
\t
%.3f µs/op
\n
"
,
hostname
,
blksize
,
n
,
float64
(
δt
)
/
float64
(
n
)
/
float64
(
time
.
Microsecond
))
fmt
.
Printf
(
"Benchmark%s/sha1/go/%
s %d
\t
%.3f µs/op
\n
"
,
hostname
,
fmtsize
(
blksize
)
,
n
,
float64
(
δt
)
/
float64
(
n
)
/
float64
(
time
.
Microsecond
))
}
go/neo/t/tsha1.py
View file @
9a266d11
...
...
@@ -27,6 +27,18 @@ import hashlib
from
time
import
time
import
socket
# fmtsize formats size in human readable form
_unitv
=
"BKMGT"
# (2^10)^i represents by corresponding char suffix
def
fmtsize
(
size
):
order
=
1
<<
10
norder
=
0
while
size
and
(
size
%
order
)
==
0
and
(
norder
+
1
<
len
(
_unitv
)):
size
//=
order
norder
+=
1
return
"%d%s"
%
(
size
,
_unitv
[
norder
])
def
main
():
blksize
=
int
(
sys
.
argv
[
1
])
data
=
'
\
0
'
*
blksize
...
...
@@ -47,7 +59,7 @@ def main():
dt
=
tend
-
tstart
hostname
=
socket
.
gethostname
()
print
(
'Benchmark%s/sha1/py/%
dB %d
\
t
%.3f µs/op'
%
(
hostname
,
blksize
,
n
,
dt
*
1E6
/
n
))
print
(
'Benchmark%s/sha1/py/%
s %d
\
t
%.3f µs/op'
%
(
hostname
,
fmtsize
(
blksize
)
,
n
,
dt
*
1E6
/
n
))
if
__name__
==
'__main__'
:
main
()
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