-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddCat Bitswap Integration Tests #444
Conversation
this is awesome. you are a god among mortals. |
Real version doesn't expose this License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
e92d48b
to
1cfe479
Compare
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
1cfe479
to
ed9b3f5
Compare
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
ed9b3f5
to
c00a7a2
Compare
RFCR @jbenet
|
adder.SetBlockstoreLatency(0) // disable blockstore latency during add operation | ||
var data bytes.Buffer | ||
// FIXME replace with a random data generator that reproduces data given a seed value | ||
io.Copy(&data, &io.LimitedReader{R: randcrypto.Reader, N: conf.DataAmountBytes}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use go-random
for a Reader with much faster randomness generation. dont really need cryptographic strength for these tests, and randcrypto is slow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Wonderful. I was looking for a way to get determinism.
The icing on the cake would be for random to provide an io.Reader
. It would cut down peak memory usage and make it possible to create larger tests. Not critical yet. The blockstore will limit test size before that will.
random.NewPseudoRandomReader(count, seed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, i thought it did. oh well
On Sat, Dec 13, 2014 at 7:41 AM, Brian Tiger Chow [email protected]
wrote:
In epictest/addcat_test.go
#444 (diff):
+func AddCatBytes(conf Config) error {
+
- sessionGenerator := bitswap.NewSessionGenerator(
tn.VirtualNetwork(delay.Fixed(conf.NetworkLatency)), // TODO rename VirtualNetwork
mockrouting.NewServerWithDelay(delay.Fixed(conf.RoutingLatency)),
- )
- adder := sessionGenerator.Next()
- catter := sessionGenerator.Next()
- catter.SetBlockstoreLatency(conf.BlockstoreLatency)
- adder.SetBlockstoreLatency(0) // disable blockstore latency during add operation
- var data bytes.Buffer
- // FIXME replace with a random data generator that reproduces data given a seed value
- io.Copy(&data, &io.LimitedReader{R: randcrypto.Reader, N: conf.DataAmountBytes})
Ah. Wonderful. I was looking for a way to get determinism.
The icing on the cake would be for random to provide an io.Reader
random.NewPseudoRandomReader(count, seed)
—
Reply to this email directly or view it on GitHub
https://github.com/jbenet/go-ipfs/pull/444/files#r21788868.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before
BenchmarkInstantaneousAddCat1MB 20 91798436 ns/op 11.42 MB/s
BenchmarkInstantaneousAddCat2MB 10 180849588 ns/op 11.60 MB/s
BenchmarkInstantaneousAddCat4MB 5 360574235 ns/op 11.63 MB/s
BenchmarkInstantaneousAddCat8MB 2 719927342 ns/op 11.65 MB/s
after
BenchmarkInstantaneousAddCat1MB 50 32412242 ns/op 32.35 MB/s
BenchmarkInstantaneousAddCat2MB 50 64622451 ns/op 32.45 MB/s
BenchmarkInstantaneousAddCat4MB 20 199377593 ns/op 21.04 MB/s
BenchmarkInstantaneousAddCat8MB 5 419447024 ns/op 20.00 MB/s
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
type D interface { | ||
Set(time.Duration) time.Duration | ||
Wait() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this setup. 👍
This is awesome. Ill rebase my changes over this. |
In case you're not interested in wading through a bayou knee-deep in merge conflicts, I got my socks wet here: https://github.com/jbenet/go-ipfs/tree/bitswap-rounds-rebase-whyohmy |
…com/multiformats/go-multihash-0.0.13 build(deps): bump github.com/multiformats/go-multihash from 0.0.10 to 0.0.13
features
datastore
,Bitswap.VirtualNetwork
, andmockrouting
types.IPFS_EPIC_TEST
learnings
status