wangkuiyi / recordio

Apache License 2.0
11 stars 2 forks source link

Use MultiWriter to simplify record writing #66

Closed zou000 closed 5 years ago

wangkuiyi commented 5 years ago

I benchmarked the performance of RecordIO before and after the merge of this PR:

yi@WangYis-iMac:/go/src/github.com/wangkuiyi/recordio (develop)*$ git checkout 88102ae995f3945d00e471c499530cc36bfe38f8
HEAD is now at 88102ae Merge pull request #63 from wangkuiyi/fix_read_old_file_failure
yi@WangYis-iMac:/go/src/github.com/wangkuiyi/recordio (detached*)*$ go test -bench=.
goos: darwin
goarch: amd64
pkg: github.com/wangkuiyi/recordio
BenchmarkSyncAndAsyncRead/Synch_reading-4                  2     796915986 ns/op
BenchmarkSyncAndAsyncRead/Async_reading-4                  3     488845638 ns/op
BenchmarkRead/reading_records_00000_to_00050-4            10     157663404 ns/op
BenchmarkRead/reading_records_00050_to_00100-4             5     212332079 ns/op
BenchmarkRead/reading_records_00100_to_00150-4            10     146070246 ns/op
PASS
ok      github.com/wangkuiyi/recordio   13.746s
yi@WangYis-iMac:/go/src/github.com/wangkuiyi/recordio (detached*)*$ git checkout develop 
Previous HEAD position was 88102ae Merge pull request #63 from wangkuiyi/fix_read_old_file_failure
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
yi@WangYis-iMac:/go/src/github.com/wangkuiyi/recordio (develop)*$ go test -bench=.
goos: darwin
goarch: amd64
pkg: github.com/wangkuiyi/recordio
BenchmarkSyncAndAsyncRead/Synch_reading-4                  2     794782354 ns/op
BenchmarkSyncAndAsyncRead/Async_reading-4                  3     493604695 ns/op
BenchmarkRead/reading_records_00000_to_00050-4            10     159072481 ns/op
BenchmarkRead/reading_records_00050_to_00100-4             5     215757693 ns/op
BenchmarkRead/reading_records_00100_to_00150-4            10     148474176 ns/op
PASS
ok      github.com/wangkuiyi/recordio   13.873s

It seems that no performance change. I like the simplification brought in by this PR.