Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(961)

Delta Between Two Patch Sets: test/scale/channel.go

Issue 4644051: code review 4644051: test: A set of scalability benchmarks. (Closed)
Left Patch Set: diff -r 6f1145ee588d https://go.googlecode.com/hg/ Created 12 years, 9 months ago
Right Patch Set: diff -r 6f1145ee588d https://go.googlecode.com/hg/ Created 12 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/scale/README ('k') | test/scale/condvar.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4
5 // Tests channel performance/scalability in different setups.
6 // chan-ring tests channel scalability in single-producer/single-consumer mode.
7 // A set of goroutines is arranged into "a ring" connected by channels,
8 // a number of small messages is passed through the ring.
9 // There are 4 variations: unbuf/buf10/buf100/buf1000 that relate to
10 // unbuffered channels and buffered channels of size 10/100/1000, respectiv ely.
11 // Buffered variations are expected to scale rather good.
12 // chan-pc tests channel scalability in multi-producer/multi-consumer mode.
13 // N producer goroutines and N consumer goroutines stress single channel.
14 // There are 4 variations: unbuf/buf10/buf100/buf1000 that relate to
15 // unbuffered channels and buffered channels of size 10/100/1000, respectiv ely.
16 // work variations execute some amount of local work before/after item prod uction/consumption.
17 // Is not expected to scale.
4 18
5 package main 19 package main
6 20
7 import ( 21 import (
8 "container/vector" 22 "container/vector"
9 "runtime" 23 "runtime"
10 ) 24 )
11 25
12 func benchmarkRing(chansize int) { 26 func benchmarkRing(chansize int) {
13 procs := runtime.GOMAXPROCS(-1) 27 procs := runtime.GOMAXPROCS(-1)
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 benchmarks.Push(&Benchmark{"chan-pc-buf10-work", func() { 160 benchmarks.Push(&Benchmark{"chan-pc-buf10-work", func() {
147 benchmarkPC(10, 100) 161 benchmarkPC(10, 100)
148 }}) 162 }})
149 benchmarks.Push(&Benchmark{"chan-pc-buf100-work", func() { 163 benchmarks.Push(&Benchmark{"chan-pc-buf100-work", func() {
150 benchmarkPC(100, 100) 164 benchmarkPC(100, 100)
151 }}) 165 }})
152 benchmarks.Push(&Benchmark{"chan-pc-buf1000-work", func() { 166 benchmarks.Push(&Benchmark{"chan-pc-buf1000-work", func() {
153 benchmarkPC(1000, 100) 167 benchmarkPC(1000, 100)
154 }}) 168 }})
155 } 169 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b