]> Cypherpunks repositories - gostls13.git/commit
runtime: use lock-free ring for work queues
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 16 Jan 2014 08:17:00 +0000 (12:17 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Thu, 16 Jan 2014 08:17:00 +0000 (12:17 +0400)
commit4722b1cbd3c734b67c0e3c1cd4458cdbd51e5844
treedc5c74456df0c3bbe50311947d3559fb37df7f85
parent2af7a26f1eaf2a8640270ac39cfd04d9aaa70ee2
runtime: use lock-free ring for work queues
Use lock-free fixed-size ring for work queues
instead of an unbounded mutex-protected array.
The ring has single producer and multiple consumers.
If the ring overflows, work is put onto global queue.

benchmark              old ns/op    new ns/op    delta
BenchmarkMatmult               7            5  -18.12%
BenchmarkMatmult-4             2            2  -18.98%
BenchmarkMatmult-16            1            0  -12.84%

BenchmarkCreateGoroutines                     105           88  -16.10%
BenchmarkCreateGoroutines-4                   376          219  -41.76%
BenchmarkCreateGoroutines-16                  241          174  -27.80%
BenchmarkCreateGoroutinesParallel             103           87  -14.66%
BenchmarkCreateGoroutinesParallel-4           169          143  -15.38%
BenchmarkCreateGoroutinesParallel-16          158          151   -4.43%

R=golang-codereviews, rsc
CC=ddetlefs, devon.odell, golang-codereviews
https://golang.org/cl/46170044
src/pkg/runtime/proc.c
src/pkg/runtime/runtime.h