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
e7fb63c5
Commit
e7fb63c5
authored
Mar 23, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X benchmarks for Iterate + fstail
parent
2ebe0d64
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
t/neo/storage/fs1/cmd/fstail/fstail.go
t/neo/storage/fs1/cmd/fstail/fstail.go
+3
-0
t/neo/storage/fs1/cmd/fstail/fstail_test.go
t/neo/storage/fs1/cmd/fstail/fstail_test.go
+10
-1
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+40
-1
No files found.
t/neo/storage/fs1/cmd/fstail/fstail.go
View file @
e7fb63c5
...
@@ -128,6 +128,9 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
...
@@ -128,6 +128,9 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
txnh
:=
fs1
.
TxnHeader
{}
txnh
:=
fs1
.
TxnHeader
{}
data
:=
[]
byte
{}
data
:=
[]
byte
{}
// TODO use SeqBufReader instead of f and check speedup
// start iterating at tail.
// start iterating at tail.
// this should get EOF but read txnh.LenPrev ok.
// this should get EOF but read txnh.LenPrev ok.
err
=
txnh
.
Load
(
f
,
topPos
,
fs1
.
LoadAll
)
err
=
txnh
.
Load
(
f
,
topPos
,
fs1
.
LoadAll
)
...
...
t/neo/storage/fs1/cmd/fstail/fstail_test.go
View file @
e7fb63c5
...
@@ -29,7 +29,7 @@ func diff(a, b string) string {
...
@@ -29,7 +29,7 @@ func diff(a, b string) string {
return
dmp
.
DiffPrettyText
(
diffv
)
return
dmp
.
DiffPrettyText
(
diffv
)
}
}
func
TestFs
Dump
(
t
*
testing
.
T
)
{
func
TestFs
Tail
(
t
*
testing
.
T
)
{
buf
:=
bytes
.
Buffer
{}
buf
:=
bytes
.
Buffer
{}
err
:=
fsTail
(
&
buf
,
"../../testdata/1.fs"
,
1000000
)
err
:=
fsTail
(
&
buf
,
"../../testdata/1.fs"
,
1000000
)
...
@@ -43,3 +43,12 @@ func TestFsDump(t *testing.T) {
...
@@ -43,3 +43,12 @@ func TestFsDump(t *testing.T) {
t
.
Errorf
(
"dump different:
\n
%v"
,
diff
(
dumpOk
,
buf
.
String
()))
t
.
Errorf
(
"dump different:
\n
%v"
,
diff
(
dumpOk
,
buf
.
String
()))
}
}
}
}
func
BenchmarkFsTail
(
b
*
testing
.
B
)
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
err
:=
fsTail
(
ioutil
.
Discard
,
"../../testdata/1.fs"
,
1000000
)
if
err
!=
nil
{
b
.
Fatal
(
err
)
}
}
}
t/neo/storage/fs1/filestorage_test.go
View file @
e7fb63c5
...
@@ -80,7 +80,7 @@ func checkLoad(t *testing.T, fs *FileStorage, xid zodb.Xid, expect oidLoadedOk)
...
@@ -80,7 +80,7 @@ func checkLoad(t *testing.T, fs *FileStorage, xid zodb.Xid, expect oidLoadedOk)
}
}
}
}
func
xfsopen
(
t
*
testing
.
T
,
path
string
)
*
FileStorage
{
func
xfsopen
(
t
testing
.
TB
,
path
string
)
*
FileStorage
{
fs
,
err
:=
Open
(
path
)
fs
,
err
:=
Open
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -265,3 +265,42 @@ func TestIterate(t *testing.T) {
...
@@ -265,3 +265,42 @@ func TestIterate(t *testing.T) {
// also check 0..tidMax
// also check 0..tidMax
testIterate
(
t
,
fs
,
0
,
zodb
.
TidMax
,
_1fs_dbEntryv
[
:
])
testIterate
(
t
,
fs
,
0
,
zodb
.
TidMax
,
_1fs_dbEntryv
[
:
])
}
}
func
BenchmarkIterate
(
b
*
testing
.
B
)
{
fs
:=
xfsopen
(
b
,
"testdata/1.fs"
)
// TODO open ro
defer
exc
.
XRun
(
fs
.
Close
)
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
iter
:=
fs
.
Iterate
(
zodb
.
Tid
(
0
),
zodb
.
TidMax
)
for
{
txni
,
dataIter
,
err
:=
iter
.
NextTxn
()
if
err
!=
nil
{
if
err
==
io
.
EOF
{
break
}
b
.
Fatal
(
err
)
}
// use txni
_
=
txni
.
Tid
for
{
datai
,
err
:=
dataIter
.
NextData
()
if
err
!=
nil
{
if
err
==
io
.
EOF
{
break
}
b
.
Fatal
(
err
)
}
// use datai
_
=
datai
.
Data
}
}
}
b
.
StopTimer
()
}
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