Go: runtime: fine-grained locking in select

Created on 7 Oct 2014  路  11Comments  路  Source: golang/go

Fine-grained locking in select provides substantial speedups:

benchmark                            old ns/op     new ns/op     delta
BenchmarkSelectUncontended           213           188           -11.74%
BenchmarkSelectUncontended-2         110           97.2          -11.64%
BenchmarkSelectUncontended-4         56.2          49.5          -11.92%
BenchmarkSelectUncontended-8         29.7          25.9          -12.79%
BenchmarkSelectUncontended-16        17.3          16.4          -5.20%
BenchmarkSelectUncontended-32        13.7          11.4          -16.79%
BenchmarkSelectSyncContended         795           710           -10.69%
BenchmarkSelectSyncContended-2       946           710           -24.95%
BenchmarkSelectSyncContended-4       1791          1187          -33.72%
BenchmarkSelectSyncContended-8       1749          637           -63.58%
BenchmarkSelectSyncContended-16      2109          563           -73.30%
BenchmarkSelectSyncContended-32      3165          1172          -62.97%
BenchmarkSelectAsyncContended        231           208           -9.96%
BenchmarkSelectAsyncContended-2      671           209           -68.85%
BenchmarkSelectAsyncContended-4      395           215           -45.57%
BenchmarkSelectAsyncContended-8      451           240           -46.78%
BenchmarkSelectAsyncContended-16     486           233           -52.06%
BenchmarkSelectAsyncContended-32     861           395           -54.12%
BenchmarkSelectNonblock              126           36.0          -71.43%
BenchmarkSelectNonblock-2            155           17.6          -88.65%
BenchmarkSelectNonblock-4            285           8.45          -97.04%
BenchmarkSelectNonblock-8            212           4.41          -97.92%
BenchmarkSelectNonblock-16           180           2.44          -98.64%
BenchmarkSelectNonblock-32           395           1.63          -99.59%
BenchmarkSelectProdCons              1140          926           -18.77%
BenchmarkSelectProdCons-2            653           545           -16.54%
BenchmarkSelectProdCons-4            519           352           -32.18%
BenchmarkSelectProdCons-8            667           372           -44.23%
BenchmarkSelectProdCons-16           751           431           -42.61%
BenchmarkSelectProdCons-32           1142          583           -48.95%

Implementation:
https://golang.org/cl/112990043/
Performance early-in-cycle

All 11 comments

Comment 1:

I wanted to get this into Go 1.4 but it fell on the floor. Sounds good for Go 1.5.

_Labels changed: added release-go1.5, removed release-none._

Postponing per CL discussion.

@dvyukov , are there any chances to resurrect this CL?

Probably not for Go 1.7: it's a big change, it's not ready, and the Go 1.7 dev freeze is just two weeks away. This is the sort of thing that would need to go in early, and it didn't.

Is there any particular reason why not?

@DmitriyMV, clarified comment

@dvyukov, Go 1.8 is open if you're feeling like a project. :-)

@dvyukov, @mdempsky, anyone else on the Go team maybe, just wondering: is there any plan to get fine-grained select locking/speedup merged in the foreseeable future?

In many situations select shows its heavy weight and it would be good to know whether this issue is going to be eventually addressed by the Go project, or you are alone up to fighting it.

"Unplanned" label and history here suggests it is 99% the latter, but there is always a bit of hope...

Thanks beforehand for feedback,
Kirill

@navytux I'm not aware of anyone working on this. It would be great if someone volunteered to carry this forward for 1.12.

@ianlancetaylor thanks for feedback. At least the status is clear.

/cc @CAFxX

Was this page helpful?
0 / 5 - 0 ratings