Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
26bf7962
Commit
26bf7962
authored
Aug 14, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: remove overlap3 and simplify overlap2
overlap3 and 2 are identical
parent
2a9ebedf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
39 deletions
+15
-39
benchmarks_test.go
benchmarks_test.go
+15
-39
No files found.
benchmarks_test.go
View file @
26bf7962
...
...
@@ -52,24 +52,20 @@ func BenchmarkDups2Nodes(b *testing.B) {
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap1
,
oneAtATime
)
})
b
.
Run
(
"Overlap2-BatchBy10"
,
func
(
b
*
testing
.
B
)
{
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap2
,
batchFetchBy10
)
})
b
.
Run
(
"Overlap3-OneAtATime"
,
func
(
b
*
testing
.
B
)
{
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
3
,
oneAtATime
)
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
2
,
oneAtATime
)
})
b
.
Run
(
"Overlap3-BatchBy10"
,
func
(
b
*
testing
.
B
)
{
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
3
,
batchFetchBy10
)
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
2
,
batchFetchBy10
)
})
b
.
Run
(
"Overlap3-AllConcurrent"
,
func
(
b
*
testing
.
B
)
{
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
3
,
fetchAllConcurrent
)
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
2
,
fetchAllConcurrent
)
})
b
.
Run
(
"Overlap3-BigBatch"
,
func
(
b
*
testing
.
B
)
{
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
3
,
batchFetchAll
)
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
2
,
batchFetchAll
)
})
b
.
Run
(
"Overlap3-UnixfsFetch"
,
func
(
b
*
testing
.
B
)
{
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
3
,
unixfsFileFetch
)
subtestDistributeAndFetch
(
b
,
3
,
100
,
fixedDelay
,
overlap
2
,
unixfsFileFetch
)
})
b
.
Run
(
"10Nodes-AllToAll-OneAtATime"
,
func
(
b
*
testing
.
B
)
{
subtestDistributeAndFetch
(
b
,
10
,
100
,
fixedDelay
,
allToAll
,
oneAtATime
)
...
...
@@ -250,38 +246,18 @@ func overlap2(b *testing.B, provs []testinstance.Instance, blks []blocks.Block)
bill
:=
provs
[
0
]
jeff
:=
provs
[
1
]
bill
.
Blockstore
()
.
Put
(
blks
[
0
])
jeff
.
Blockstore
()
.
Put
(
blks
[
0
])
for
i
,
blk
:=
range
blks
{
if
i
%
3
==
0
{
bill
.
Blockstore
()
.
Put
(
blk
)
jeff
.
Blockstore
()
.
Put
(
blk
)
}
else
if
i
%
2
==
1
{
bill
.
Blockstore
()
.
Put
(
blk
)
}
else
{
jeff
.
Blockstore
()
.
Put
(
blk
)
even
:=
i
%
2
==
0
third
:=
i
%
3
==
0
if
third
||
even
{
if
err
:=
bill
.
Blockstore
()
.
Put
(
blk
);
err
!=
nil
{
b
.
Fatal
(
err
)
}
}
}
}
func
overlap3
(
b
*
testing
.
B
,
provs
[]
testinstance
.
Instance
,
blks
[]
blocks
.
Block
)
{
if
len
(
provs
)
!=
2
{
b
.
Fatal
(
"overlap3 only works with 2 provs"
)
}
bill
:=
provs
[
0
]
jeff
:=
provs
[
1
]
bill
.
Blockstore
()
.
Put
(
blks
[
0
])
jeff
.
Blockstore
()
.
Put
(
blks
[
0
])
for
i
,
blk
:=
range
blks
{
if
i
%
3
==
0
{
bill
.
Blockstore
()
.
Put
(
blk
)
jeff
.
Blockstore
()
.
Put
(
blk
)
}
else
if
i
%
2
==
1
{
bill
.
Blockstore
()
.
Put
(
blk
)
}
else
{
jeff
.
Blockstore
()
.
Put
(
blk
)
if
third
||
!
even
{
if
err
:=
jeff
.
Blockstore
()
.
Put
(
blk
);
err
!=
nil
{
b
.
Fatal
(
err
)
}
}
}
}
...
...
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