Commit 47c9a35
committed
auto merge of #10830 : alexcrichton/rust/spsc-queue, r=brson
This pull request completely rewrites std::comm and all associated users. Some major bullet points
* Everything now works natively
* oneshots have been removed
* shared ports have been removed
* try_recv no longer blocks (recv_opt blocks)
* constructors are now Chan::new and SharedChan::new
* failure is propagated on send
* stream channels are 3x faster
I have acquired the following measurements on this patch. I compared against Go, but remember that Go's channels are fundamentally different than ours in that sends are by-default blocking. This means that it's not really a totally fair comparison, but it's good to see ballpark numbers for anyway
```
oneshot stream shared1
std 2.111 3.073 1.730
my 6.639 1.037 1.238
native 5.748 1.017 1.250
go8 1.774 3.575 2.948
go8-inf slow 0.837 1.376
go8-128 4.832 1.430 1.504
go1 1.528 1.439 1.251
go2 1.753 3.845 3.166
```
I had three benchmarks:
* oneshot - N times, create a "oneshot channel", send on it, then receive on it (no task spawning)
* stream - N times, send from one task to another task, wait for both to complete
* shared1 - create N threads, each of which sends M times, and a port receives N*M times.
The rows are as follows:
* `std` - the current libstd implementation (before this pull request)
* `my` - this pull request's implementation (in M:N mode)
* `native` - this pull request's implementation (in 1:1 mode)
* `goN` - go's implementation with GOMAXPROCS=N. The only relevant value is 8 (I had 8 cores on this machine)
* `goN-X` - go's implementation where the channels in question were created with buffers of size `X` to behave more similarly to rust's channels.File tree
104 files changed
+3519
-3130
lines changed- doc
- src
- etc
- libextra
- librustc
- librustdoc/html
- librustuv
- libstd
- comm
- io
- net
- rand
- rt
- task
- unstable
- test
- auxiliary
- bench
- compile-fail
- run-pass
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
104 files changed
+3519
-3130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | 132 | | |
134 | | - | |
| 133 | + | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
153 | | - | |
154 | | - | |
| 152 | + | |
155 | 153 | | |
156 | 154 | | |
157 | 155 | | |
| |||
160 | 158 | | |
161 | 159 | | |
162 | 160 | | |
163 | | - | |
164 | 161 | | |
165 | | - | |
| 162 | + | |
166 | 163 | | |
167 | 164 | | |
168 | 165 | | |
| |||
180 | 177 | | |
181 | 178 | | |
182 | 179 | | |
183 | | - | |
184 | 180 | | |
185 | | - | |
| 181 | + | |
186 | 182 | | |
187 | 183 | | |
188 | 184 | | |
189 | 185 | | |
190 | 186 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
196 | 192 | | |
197 | 193 | | |
198 | 194 | | |
199 | | - | |
200 | 195 | | |
201 | | - | |
| 196 | + | |
202 | 197 | | |
203 | 198 | | |
204 | 199 | | |
| |||
216 | 211 | | |
217 | 212 | | |
218 | 213 | | |
219 | | - | |
220 | 214 | | |
221 | | - | |
222 | | - | |
| 215 | + | |
223 | 216 | | |
224 | 217 | | |
225 | 218 | | |
| |||
238 | 231 | | |
239 | 232 | | |
240 | 233 | | |
241 | | - | |
| 234 | + | |
242 | 235 | | |
243 | 236 | | |
244 | 237 | | |
245 | 238 | | |
246 | | - | |
| 239 | + | |
247 | 240 | | |
248 | 241 | | |
249 | 242 | | |
250 | 243 | | |
251 | 244 | | |
252 | | - | |
253 | 245 | | |
254 | 246 | | |
255 | 247 | | |
256 | 248 | | |
257 | | - | |
| 249 | + | |
258 | 250 | | |
259 | 251 | | |
260 | 252 | | |
| |||
341 | 333 | | |
342 | 334 | | |
343 | 335 | | |
344 | | - | |
| 336 | + | |
345 | 337 | | |
346 | 338 | | |
347 | 339 | | |
| |||
370 | 362 | | |
371 | 363 | | |
372 | 364 | | |
373 | | - | |
| 365 | + | |
374 | 366 | | |
375 | 367 | | |
376 | 368 | | |
| |||
382 | 374 | | |
383 | 375 | | |
384 | 376 | | |
385 | | - | |
| 377 | + | |
386 | 378 | | |
387 | 379 | | |
388 | 380 | | |
| |||
499 | 491 | | |
500 | 492 | | |
501 | 493 | | |
502 | | - | |
| 494 | + | |
503 | 495 | | |
504 | 496 | | |
505 | 497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | | - | |
601 | 600 | | |
602 | 601 | | |
603 | 602 | | |
604 | 603 | | |
605 | 604 | | |
606 | 605 | | |
607 | 606 | | |
608 | | - | |
| 607 | + | |
609 | 608 | | |
610 | 609 | | |
611 | 610 | | |
| |||
626 | 625 | | |
627 | 626 | | |
628 | 627 | | |
629 | | - | |
| 628 | + | |
630 | 629 | | |
631 | 630 | | |
632 | 631 | | |
| |||
636 | 635 | | |
637 | 636 | | |
638 | 637 | | |
639 | | - | |
640 | 638 | | |
641 | | - | |
| 639 | + | |
642 | 640 | | |
643 | 641 | | |
644 | 642 | | |
| |||
650 | 648 | | |
651 | 649 | | |
652 | 650 | | |
653 | | - | |
| 651 | + | |
654 | 652 | | |
655 | 653 | | |
656 | 654 | | |
| |||
687 | 685 | | |
688 | 686 | | |
689 | 687 | | |
690 | | - | |
| 688 | + | |
691 | 689 | | |
692 | 690 | | |
693 | 691 | | |
| |||
804 | 802 | | |
805 | 803 | | |
806 | 804 | | |
807 | | - | |
| 805 | + | |
808 | 806 | | |
809 | 807 | | |
810 | 808 | | |
| |||
832 | 830 | | |
833 | 831 | | |
834 | 832 | | |
835 | | - | |
| 833 | + | |
836 | 834 | | |
837 | 835 | | |
838 | 836 | | |
| |||
855 | 853 | | |
856 | 854 | | |
857 | 855 | | |
858 | | - | |
| 856 | + | |
859 | 857 | | |
860 | 858 | | |
861 | 859 | | |
| |||
869 | 867 | | |
870 | 868 | | |
871 | 869 | | |
872 | | - | |
| 870 | + | |
873 | 871 | | |
874 | 872 | | |
875 | 873 | | |
| |||
897 | 895 | | |
898 | 896 | | |
899 | 897 | | |
900 | | - | |
| 898 | + | |
901 | 899 | | |
902 | 900 | | |
903 | 901 | | |
904 | 902 | | |
905 | 903 | | |
906 | 904 | | |
907 | | - | |
| 905 | + | |
908 | 906 | | |
909 | 907 | | |
910 | 908 | | |
| |||
926 | 924 | | |
927 | 925 | | |
928 | 926 | | |
929 | | - | |
| 927 | + | |
930 | 928 | | |
931 | 929 | | |
932 | 930 | | |
| |||
951 | 949 | | |
952 | 950 | | |
953 | 951 | | |
954 | | - | |
| 952 | + | |
955 | 953 | | |
956 | 954 | | |
957 | 955 | | |
| |||
0 commit comments