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
f7e23ed8
Commit
f7e23ed8
authored
Oct 06, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9ccda1cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
32 deletions
+22
-32
go/neo/t/zhash.go
go/neo/t/zhash.go
+6
-9
go/neo/t/zhash.py
go/neo/t/zhash.py
+16
-23
No files found.
go/neo/t/zhash.go
View file @
f7e23ed8
...
@@ -143,7 +143,9 @@ func zhash(ctx context.Context, url string, h hasher, useprefetch bool) (err err
...
@@ -143,7 +143,9 @@ func zhash(ctx context.Context, url string, h hasher, useprefetch bool) (err err
}
}
}
}
// prefetchBlk prefetches block of 512 objects starting from xid
const
nprefetch
=
128
// XXX -> 512 ?
// prefetchBlk prefetches block of nprefetch objects starting from xid
//var tprevLoadBlkStart time.Time
//var tprevLoadBlkStart time.Time
prefetchBlk
:=
func
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
{
prefetchBlk
:=
func
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
{
if
cache
==
nil
{
if
cache
==
nil
{
...
@@ -151,8 +153,7 @@ func zhash(ctx context.Context, url string, h hasher, useprefetch bool) (err err
...
@@ -151,8 +153,7 @@ func zhash(ctx context.Context, url string, h hasher, useprefetch bool) (err err
}
}
//t1 := time.Now()
//t1 := time.Now()
//for i := 0; i < 512; i++ {
for
i
:=
0
;
i
<
nprefetch
;
i
++
{
for
i
:=
0
;
i
<
8
;
i
++
{
prefetch
(
ctx
,
xid
)
prefetch
(
ctx
,
xid
)
xid
.
Oid
++
xid
.
Oid
++
}
}
...
@@ -181,17 +182,14 @@ func zhash(ctx context.Context, url string, h hasher, useprefetch bool) (err err
...
@@ -181,17 +182,14 @@ func zhash(ctx context.Context, url string, h hasher, useprefetch bool) (err err
//defer profile.Start(profile.CPUProfile).Stop()
//defer profile.Start(profile.CPUProfile).Stop()
}
}
for
qqq
:=
0
;
qqq
<
1
;
qqq
++
{
tstart
:=
time
.
Now
()
tstart
:=
time
.
Now
()
h
.
Reset
()
// XXX temp
oid
:=
zodb
.
Oid
(
0
)
oid
:=
zodb
.
Oid
(
0
)
nread
:=
0
nread
:=
0
loop
:
loop
:
for
{
for
{
xid
:=
zodb
.
Xid
{
Oid
:
oid
,
XTid
:
zodb
.
XTid
{
Tid
:
before
,
TidBefore
:
true
}}
xid
:=
zodb
.
Xid
{
Oid
:
oid
,
XTid
:
zodb
.
XTid
{
Tid
:
before
,
TidBefore
:
true
}}
//if xid.Oid % 512 == 0 {
if
xid
.
Oid
%
nprefetch
==
0
{
if
xid
.
Oid
%
8
==
0
{
prefetchBlk
(
ctx
,
xid
)
prefetchBlk
(
ctx
,
xid
)
}
}
buf
,
_
,
err
:=
load
(
ctx
,
xid
)
buf
,
_
,
err
:=
load
(
ctx
,
xid
)
...
@@ -220,11 +218,10 @@ loop:
...
@@ -220,11 +218,10 @@ loop:
x
:=
"zhash.go"
x
:=
"zhash.go"
if
useprefetch
{
if
useprefetch
{
x
+=
" +prefetch"
x
+=
fmt
.
Sprintf
(
" +prefetch%d"
,
nprefetch
)
}
}
fmt
.
Printf
(
"%s:%x ; oid=0..%d nread=%d t=%s (%s / object) x=%s
\n
"
,
fmt
.
Printf
(
"%s:%x ; oid=0..%d nread=%d t=%s (%s / object) x=%s
\n
"
,
h
.
name
,
h
.
Sum
(
nil
),
oid
-
1
,
nread
,
δt
,
δt
/
time
.
Duration
(
oid
),
x
)
// XXX /oid cast ?
h
.
name
,
h
.
Sum
(
nil
),
oid
-
1
,
nread
,
δt
,
δt
/
time
.
Duration
(
oid
),
x
)
// XXX /oid cast ?
}
return
nil
return
nil
}
}
go/neo/t/zhash.py
View file @
f7e23ed8
...
@@ -121,15 +121,8 @@ def main():
...
@@ -121,15 +121,8 @@ def main():
last_tid
=
stor
.
lastTransaction
()
last_tid
=
stor
.
lastTransaction
()
before
=
p64
(
u64
(
last_tid
)
+
1
)
before
=
p64
(
u64
(
last_tid
)
+
1
)
for
zzz
in
range
(
1
):
tstart
=
time
()
tstart
=
time
()
# vvv h.reset() XXX temp
try
:
h
=
h
.
__class__
()
except
:
h
=
hashlib
.
new
(
h
.
name
)
oid
=
0
oid
=
0
nread
=
0
nread
=
0
while
1
:
while
1
:
...
...
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