From 88e3540ee4ab04e9b418915f44f512c1b4c09ec6 Mon Sep 17 00:00:00 2001 From: Bruce Marriner Date: Wed, 25 May 2016 15:42:14 -0500 Subject: [PATCH] added channel parallel benchmark --- flake_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/flake_test.go b/flake_test.go index ac1a2e2..b002139 100644 --- a/flake_test.go +++ b/flake_test.go @@ -20,6 +20,21 @@ func BenchmarkGenerateChan(b *testing.B) { } +// Benchmarks Presence Update event with fake data. +func BenchmarkGenerateChanParallel(b *testing.B) { + + node, _ := NewFlakeNode(1) + c := make(chan Flake) + go node.Generator(c) + + b.ReportAllocs() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + <-c + } + }) +} + // Benchmarks Presence Update event with fake data. func BenchmarkGenerate(b *testing.B) {