aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.