aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-07-04 21:34:56 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-07-04 21:34:56 +0200
commitbc44e254b00895844f1952c73eeea3cfd765984c (patch)
treefac754cbf266dc85ef609c47ef8c59422c36d8ae /skate
parentd8404da85ed7bc2852edfdf83152a8611d95b406 (diff)
downloadrefcat-bc44e254b00895844f1952c73eeea3cfd765984c.tar.gz
refcat-bc44e254b00895844f1952c73eeea3cfd765984c.zip
update docs
Diffstat (limited to 'skate')
-rw-r--r--skate/zipkey/batch_test.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/skate/zipkey/batch_test.go b/skate/zipkey/batch_test.go
index 38a1307..6156fbf 100644
--- a/skate/zipkey/batch_test.go
+++ b/skate/zipkey/batch_test.go
@@ -40,11 +40,15 @@ func TestBatcherLarge(t *testing.T) {
N = 1000000
numWorkers = 24
size = 7000
+
// We share a single writer across threads, so we need to guard each
// write. TODO: measure performance impact.
mu sync.Mutex
buf bytes.Buffer
- f = func(g *Group) error {
+
+ // The reducer is a simple function that will write "1" into the
+ // buffer, if the groups are equal, "0" otherwise.
+ f = func(g *Group) error {
var v string
if reflect.DeepEqual(g.G0, g.G1) {
v = "1"
@@ -62,6 +66,7 @@ func TestBatcherLarge(t *testing.T) {
)
b.Size = size
b.NumWorkers = numWorkers
+
for i := 0; i < N; i++ {
var u, v string
if i%2 == 0 {
@@ -87,3 +92,5 @@ func TestBatcherLarge(t *testing.T) {
t.Fatalf("got %v, want %v (count0=%v, buf=%s)", count1, N/2, count0, buf.String())
}
}
+
+// TODO: BenchmarkBatcher with different worker counts.