Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Add steal_many #15

Merged
6 commits merged into from Aug 9, 2018
Merged

Add steal_many #15

6 commits merged into from Aug 9, 2018

Conversation

ghost
Copy link

@ghost ghost commented Aug 8, 2018

This PR merges fifo.rs and lifo.rs together, adds new method steal_many, and changes the return type of pop.

Benchmarks in tokio-threadpool:

 name                    before ns/iter  after ns/iter  diff ns/iter  diff %  speedup
 threadpool::spawn_many  3,563,790       3,548,500           -15,290  -0.43%   x 1.00
 threadpool::yield_many  12,171,989      11,606,183         -565,806  -4.65%   x 1.05

Some of the wins are due to better optimized spinning (it's handled in tokio with Steal::Retry, while previously spinning was entirely contained inside Stealer::steal).

Closes #4

@ghost
Copy link
Author

ghost commented Aug 8, 2018

Rayon benchmarks:

 factorial::factorial_iterator                                       19,197,280             19,288,249                   90,969    0.47%   x 1.00
 factorial::factorial_join                                           2,674,038              2,856,833                   182,795    6.84%   x 0.94
 factorial::factorial_par_iter                                       2,557,865              2,674,078                   116,213    4.54%   x 0.96
 factorial::factorial_recursion                                      3,082,174              3,176,094                    93,920    3.05%   x 0.97
 fibonacci::fibonacci_iterative                                      6                      6                                 0    0.00%   x 1.00
 fibonacci::fibonacci_join_1_2                                       57,271,590             49,210,576               -8,061,014  -14.08%   x 1.16
 fibonacci::fibonacci_join_2_1                                       48,046,315             48,232,800                  186,485    0.39%   x 1.00
 fibonacci::fibonacci_recursive                                      11,010,701             11,839,683                  828,982    7.53%   x 0.93
 fibonacci::fibonacci_split_iterative                                27,170                 30,079                        2,909   10.71%   x 0.90
 fibonacci::fibonacci_split_recursive                                6,336,907              6,431,466                    94,559    1.49%   x 0.99
 find::size1::parallel_find_common                                   7,215                  7,296                            81    1.12%   x 0.99
 find::size1::parallel_find_first                                    4,220                  4,852                           632   14.98%   x 0.87
 find::size1::parallel_find_last                                     3,811,913              3,959,520                   147,607    3.87%   x 0.96
 find::size1::parallel_find_middle                                   2,545,866              2,526,675                   -19,191   -0.75%   x 1.01
 find::size1::parallel_find_missing                                  3,938,847              4,034,027                    95,180    2.42%   x 0.98
 find::size1::serial_find_common                                     1,939                  1,936                            -3   -0.15%   x 1.00
 find::size1::serial_find_first                                      1                      1                                 0    0.00%   x 1.00
 find::size1::serial_find_last                                       4,138,680              4,165,122                    26,442    0.64%   x 0.99
 find::size1::serial_find_middle                                     2,860,534              2,780,353                   -80,181   -2.80%   x 1.03
 find::size1::serial_find_missing                                    4,130,625              4,157,499                    26,874    0.65%   x 0.99
 join_microbench::increment_all                                      38,484                 43,734                        5,250   13.64%   x 0.88
 join_microbench::increment_all_atomized                             2,564,093              2,501,344                   -62,749   -2.45%   x 1.03
 join_microbench::increment_all_max                                  84,965                 89,989                        5,024    5.91%   x 0.94
 join_microbench::increment_all_min                                  29,631                 30,564                          933    3.15%   x 0.97
 join_microbench::increment_all_serialized                           39,819                 39,958                          139    0.35%   x 1.00
 join_microbench::join_recursively                                   933,041                886,676                     -46,365   -4.97%   x 1.05
 life::bench::as_parallel_generations                                522,270,832            522,470,226                 199,394    0.04%   x 1.00
 life::bench::generations                                            130,343,907            129,888,951                -454,956   -0.35%   x 1.00
 life::bench::parallel_generations                                   55,533,131             56,858,894                1,325,763    2.39%   x 0.98
 map_collect::i_mod_10_to_i::with_collect                            9,001,844              9,132,965                   131,121    1.46%   x 0.99
 map_collect::i_mod_10_to_i::with_fold                               3,984,070              4,203,013                   218,943    5.50%   x 0.95
 map_collect::i_mod_10_to_i::with_fold_vec                           4,538,755              4,691,997                   153,242    3.38%   x 0.97
 map_collect::i_mod_10_to_i::with_linked_list_collect                17,011,076             16,584,602                 -426,474   -2.51%   x 1.03
 map_collect::i_mod_10_to_i::with_linked_list_collect_vec            7,716,738              7,834,976                   118,238    1.53%   x 0.98
 map_collect::i_mod_10_to_i::with_linked_list_collect_vec_sized      9,358,593              9,525,245                   166,652    1.78%   x 0.98
 map_collect::i_mod_10_to_i::with_linked_list_map_reduce_vec_sized   9,022,822              9,034,552                    11,730    0.13%   x 1.00
 map_collect::i_mod_10_to_i::with_mutex                              69,347,858             72,063,225                2,715,367    3.92%   x 0.96
 map_collect::i_mod_10_to_i::with_mutex_vec                          10,452,009             10,824,518                  372,509    3.56%   x 0.97
 map_collect::i_mod_10_to_i::with_vec_vec_sized                      8,910,886              9,023,208                   112,322    1.26%   x 0.99
 map_collect::i_to_i::with_collect                                   28,606,999             28,347,388                 -259,611   -0.91%   x 1.01
 map_collect::i_to_i::with_fold                                      77,027,845             82,575,900                5,548,055    7.20%   x 0.93
 map_collect::i_to_i::with_fold_vec                                  76,499,403             82,074,206                5,574,803    7.29%   x 0.93
 map_collect::i_to_i::with_linked_list_collect                       38,915,261             38,009,858                 -905,403   -2.33%   x 1.02
 map_collect::i_to_i::with_linked_list_collect_vec                   37,905,973             38,577,767                  671,794    1.77%   x 0.98
 map_collect::i_to_i::with_linked_list_collect_vec_sized             30,016,425             29,340,421                 -676,004   -2.25%   x 1.02
 map_collect::i_to_i::with_linked_list_map_reduce_vec_sized          28,537,139             28,661,547                  124,408    0.44%   x 1.00
 map_collect::i_to_i::with_mutex                                     128,029,957            130,934,487               2,904,530    2.27%   x 0.98
 map_collect::i_to_i::with_mutex_vec                                 50,142,918             51,628,736                1,485,818    2.96%   x 0.97
 map_collect::i_to_i::with_vec_vec_sized                             28,930,722             28,621,925                 -308,797   -1.07%   x 1.01
 matmul::bench::bench_matmul_strassen                                6,531,975              6,559,291                    27,316    0.42%   x 1.00
 mergesort::bench::merge_sort_par_bench                              9,409,559              9,289,732                  -119,827   -1.27%   x 1.01
 mergesort::bench::merge_sort_seq_bench                              27,773,968             27,679,008                  -94,960   -0.34%   x 1.00
 nbody::bench::nbody_par                                             18,855,225             18,809,061                  -46,164   -0.24%   x 1.00
 nbody::bench::nbody_par_bridge                                      18,339,773             19,174,396                  834,623    4.55%   x 0.96
 nbody::bench::nbody_parreduce                                       38,060,868             39,151,065                1,090,197    2.86%   x 0.97
 nbody::bench::nbody_seq                                             42,088,394             42,535,883                  447,489    1.06%   x 0.99
 pythagoras::euclid_faux_serial                                      33,562,839             33,682,226                  119,387    0.36%   x 1.00
 pythagoras::euclid_parallel_full                                    73,998,851             73,639,899                 -358,952   -0.49%   x 1.00
 pythagoras::euclid_parallel_one                                     12,173,047             12,032,539                 -140,508   -1.15%   x 1.01
 pythagoras::euclid_parallel_outer                                   12,095,393             11,898,078                 -197,315   -1.63%   x 1.02
 pythagoras::euclid_parallel_weightless                              12,085,512             12,101,750                   16,238    0.13%   x 1.00
 pythagoras::euclid_serial                                           33,247,090             30,084,810               -3,162,280   -9.51%   x 1.11
 quicksort::bench::quick_sort_par_bench                              16,571,532             16,411,665                 -159,867   -0.96%   x 1.01
 quicksort::bench::quick_sort_seq_bench                              40,344,696             40,080,376                 -264,320   -0.66%   x 1.01
 quicksort::bench::quick_sort_splitter                               21,040,440             19,649,396               -1,391,044   -6.61%   x 1.07
 sieve::bench::sieve_chunks                                          10,510,473             10,438,599                  -71,874   -0.68%   x 1.01
 sieve::bench::sieve_parallel                                        6,512,114              6,519,326                     7,212    0.11%   x 1.00
 sieve::bench::sieve_serial                                          23,788,687             24,117,128                  328,441    1.38%   x 0.99
 sort::demo_merge_sort_ascending                                     132,291 (3023 MB/s)    131,572 (3040 MB/s)            -719   -0.54%   x 1.01
 sort::demo_merge_sort_big                                           10,342,530 (618 MB/s)  10,402,822 (615 MB/s)        60,292    0.58%   x 0.99
 sort::demo_merge_sort_descending                                    166,150 (2407 MB/s)    167,263 (2391 MB/s)           1,113    0.67%   x 0.99
 sort::demo_merge_sort_mostly_ascending                              365,265 (1095 MB/s)    363,908 (1099 MB/s)          -1,357   -0.37%   x 1.00
 sort::demo_merge_sort_mostly_descending                             409,707 (976 MB/s)     405,144 (987 MB/s)           -4,563   -1.11%   x 1.01
 sort::demo_merge_sort_random                                        1,716,228 (233 MB/s)   1,698,890 (235 MB/s)        -17,338   -1.01%   x 1.01
 sort::demo_merge_sort_strings                                       5,012,530 (159 MB/s)   5,115,864 (156 MB/s)        103,334    2.06%   x 0.98
 sort::demo_quick_sort_big                                           8,165,314 (783 MB/s)   8,246,772 (776 MB/s)         81,458    1.00%   x 0.99
 sort::demo_quick_sort_mostly_ascending                              18,654,121 (21 MB/s)   19,211,662 (20 MB/s)        557,541    2.99%   x 0.97
 sort::demo_quick_sort_mostly_descending                             11,903,002 (33 MB/s)   12,383,304 (32 MB/s)        480,302    4.04%   x 0.96
 sort::demo_quick_sort_random                                        1,478,722 (270 MB/s)   1,476,785 (270 MB/s)         -1,937   -0.13%   x 1.00
 sort::demo_quick_sort_strings                                       6,241,767 (128 MB/s)   6,225,578 (128 MB/s)        -16,189   -0.26%   x 1.00
 sort::par_sort_ascending                                            61,786 (6473 MB/s)     63,897 (6260 MB/s)            2,111    3.42%   x 0.97
 sort::par_sort_big                                                  11,183,151 (572 MB/s)  11,191,287 (571 MB/s)         8,136    0.07%   x 1.00
 sort::par_sort_descending                                           117,688 (3398 MB/s)    122,058 (3277 MB/s)           4,370    3.71%   x 0.96
 sort::par_sort_expensive                                            68,791,700 (5 MB/s)    69,350,609 (5 MB/s)         558,909    0.81%   x 0.99
 sort::par_sort_mostly_ascending                                     377,197 (1060 MB/s)    383,283 (1043 MB/s)           6,086    1.61%   x 0.98
 sort::par_sort_mostly_descending                                    409,727 (976 MB/s)     415,129 (963 MB/s)            5,402    1.32%   x 0.99
 sort::par_sort_random                                               1,326,204 (301 MB/s)   1,337,224 (299 MB/s)         11,020    0.83%   x 0.99
 sort::par_sort_strings                                              4,226,276 (189 MB/s)   4,214,945 (189 MB/s)        -11,331   -0.27%   x 1.00
 sort::par_sort_unstable_ascending                                   48,396 (8265 MB/s)     48,464 (8253 MB/s)               68    0.14%   x 1.00
 sort::par_sort_unstable_big                                         6,816,799 (938 MB/s)   6,801,822 (940 MB/s)        -14,977   -0.22%   x 1.00
 sort::par_sort_unstable_descending                                  71,187 (5619 MB/s)     71,601 (5586 MB/s)              414    0.58%   x 0.99
 sort::par_sort_unstable_expensive                                   79,047,756 (5 MB/s)    77,118,163 (5 MB/s)      -1,929,593   -2.44%   x 1.03
 sort::par_sort_unstable_mostly_ascending                            321,047 (1245 MB/s)    325,111 (1230 MB/s)           4,064    1.27%   x 0.99
 sort::par_sort_unstable_mostly_descending                           342,379 (1168 MB/s)    352,487 (1134 MB/s)          10,108    2.95%   x 0.97
 sort::par_sort_unstable_random                                      742,242 (538 MB/s)     747,151 (535 MB/s)            4,909    0.66%   x 0.99
 sort::par_sort_unstable_strings                                     4,237,318 (188 MB/s)   4,285,355 (186 MB/s)         48,037    1.13%   x 0.99
 str_split::parallel_space_char                                      1,337,651              1,343,127                     5,476    0.41%   x 1.00
 str_split::parallel_space_fn                                        903,802                904,327                         525    0.06%   x 1.00
 str_split::serial_space_char                                        2,993,653              3,073,927                    80,274    2.68%   x 0.97
 str_split::serial_space_fn                                          1,635,689              1,529,288                  -106,401   -6.50%   x 1.07
 str_split::serial_space_str                                         2,305,368              2,300,641                    -4,727   -0.21%   x 1.00
 tsp::bench::dj10                                                    11,421,117             11,189,734                 -231,383   -2.03%   x 1.02
 vec_collect::vec_i::with_collect                                    3,809,172              3,993,316                   184,144    4.83%   x 0.95
 vec_collect::vec_i::with_collect_into_vec                           3,794,252              3,994,567                   200,315    5.28%   x 0.95
 vec_collect::vec_i::with_collect_into_vec_reused                    1,817,590              2,330,346                   512,756   28.21%   x 0.78
 vec_collect::vec_i::with_fold                                       50,996,670             54,280,940                3,284,270    6.44%   x 0.94
 vec_collect::vec_i::with_linked_list_collect_vec                    41,426,209             40,348,919               -1,077,290   -2.60%   x 1.03
 vec_collect::vec_i::with_linked_list_collect_vec_sized              34,966,234             35,896,233                  929,999    2.66%   x 0.97
 vec_collect::vec_i::with_linked_list_map_reduce_vec_sized           24,610,179             24,858,848                  248,669    1.01%   x 0.99
 vec_collect::vec_i::with_vec_vec_sized                              24,259,872             25,105,698                  845,826    3.49%   x 0.97
 vec_collect::vec_i_filtered::with_collect                           31,520,106             25,033,713               -6,486,393  -20.58%   x 1.26
 vec_collect::vec_i_filtered::with_fold                              54,750,519             54,326,315                 -424,204   -0.77%   x 1.01
 vec_collect::vec_i_filtered::with_linked_list_collect_vec           45,404,376             41,431,847               -3,972,529   -8.75%   x 1.10
 vec_collect::vec_i_filtered::with_linked_list_collect_vec_sized     39,431,510             36,750,466               -2,681,044   -6.80%   x 1.07
 vec_collect::vec_i_filtered::with_linked_list_map_reduce_vec_sized  31,512,823             24,818,102               -6,694,721  -21.24%   x 1.27
 vec_collect::vec_i_filtered::with_vec_vec_sized                     31,636,532             25,005,764               -6,630,768  -20.96%   x 1.27

@ghost ghost mentioned this pull request Aug 9, 2018
@ghost
Copy link
Author

ghost commented Aug 9, 2018

I'm going to merge this now so that tokio can start using it. If there are any concerns with this PR, feel free to comment here.

@ghost ghost merged commit b46654c into crossbeam-rs:master Aug 9, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

0 participants