rust channel benchmarks to keep stat of performance of Kanal library in comparison with other competitors.

Overview

Rust Channel Benchmarks

This is a highly modified fork of the crossbeam-channel benchmarks. to keep track of Kanal library stats in comparison with other competitors.

Tests

  • seq: A single thread sends N messages. Then it receives N messages.
  • spsc: One thread sends N messages. Another thread receives N messages.
  • mpsc: T threads send N / T messages each. One thread receives N messages.
  • mpmc: T threads send N / T messages each. T other threads receive N / T messages each.
  • select_rx: T threads send N / T messages each into a separate channel. Another thread receives N messages by selecting over the T channels.
  • select_both: T threads send N / T messages each by selecting over T channels. T other threads receive N / T messages each by selecting over the T channels.

Default configuration:

  • N = 5000000
  • T = 4

Running

Runs benchmarks, stores results into *.csv files in the target folder, and generates multiple png file for each test category:

# Results will be saved in `target`.
./run.sh

Dependencies:

  • Rust (latest)
  • Go
  • Bash
  • libcairo2-dev
  • Python
    • pygal
    • cairosvg
    • tk
    • PIL

Contributing

You can follow community benchmarks, and also share your results by opening an issue with the format shown in results section.

Results

Machine: AMD Ryzen Threadripper 2950X 16-Core Processor
Rust: rustc 1.62.0
Go: go version go1.18.3 linux/amd64
OS (uname -a): Linux 5.13.0-35-generic #40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Date: July 15, 2022

Benchmark bounded channel with size 0 Benchmark bounded channel with size 1 Benchmark bounded channel with size n Benchmark unbounded channel

Comments
  • Please clarify the benchmark output for each test

    Please clarify the benchmark output for each test

    I isolated just one particular use case I am familiar with and interested in seeing how it compares with flume in particular.

    I changed both of these: https://github.com/fereidani/rust-channel-benchmarks/blob/main/z_run.rs#L20 https://github.com/fereidani/rust-channel-benchmarks/blob/main/z_run.rs#L44

    to better describe what the numbers dumped mean:

    "{}, avg duration of one message sent/received through channel as nanoseconds:<<{}>>, messages per second:<<{}>>",
    

    as believe this is what it truly describes. Is that right or did I misunderstand?

    Here are the number on fedora silverblue 37 on an 8-core phenomx8

    flume
    bounded_mpsc(usize), avg duration of one message sent/received through channel as nanoseconds:<<158900701>>, messages per second:<<3146619>>
    
    flume-async
    bounded_mpsc(usize), avg duration of one message sent/received through channel as nanoseconds:<<199120601>>, messages per second:<<2511041>>
    
    kanal
    bounded_mpsc(usize), avg duration of one message sent/received through channel as nanoseconds:<<182064603>>, messages per second:<<2746278>>
    
    kanal-async
    bounded_mpsc(usize), avg duration of one message sent/received through channel as nanoseconds:<<224280043>>, messages per second:<<2229356>>
    

    So when I read the above it seems to indicate it takes more nanoseconds for async message passing. Did I misunderstand? kanal also seems to process less messages per second? Did I also misunderstand this?

    The following indicates to me that flume is faster with the numbers I get: flume 3146619 messages per second > kanal 2746278 messages per second > flume-async 2511041 messages per second > kanal-async 2229356 messages per second

    Again when I look at average one message durations, flume 158900701 nanoseconds < kanal 182064603 nanoseconds < flume async 199120601 nanoseconds < kanal async 224280043 nanoseconds

    Did I misunderstand all this?

    From what I just observed, 1)flume is faster than flume async. 2)kanal is faster than kanal async. 3)kanal is faster than flume async 4)kanal async is the slowest. 5)flume is the fastest.

    opened by omac777 11
  • benchmarks on fedora 32 riscv64 emulated on phenom x8 with 4 cores

    benchmarks on fedora 32 riscv64 emulated on phenom x8 with 4 cores

    Ran your benchmarks on fedora 32 riscv64 emulated on phenom x8 with 4 cores setup as follows https://discussion.fedoraproject.org/t/risc-v-newbie-attempting-to-run-fedora-in-qemu-and-share-experience-with-everybody/44150

    The actual qemu command I used to run this virtual machine:

    
     $ cd riscvplay/
    davidm@carouselYOW 2022-11-17_13:00:28_EST : ~/riscvplay
     $ qemu-system-riscv64   -bios none   -nographic   -machine virt   -smp 4   -m 2G   -kernel Fedora-Developer-Rawhide-20200108.n.0-fw_payload-uboot-qemu-virt-smode.elf   -object rng-random,filename=/dev/urandom,id=rng0   -device virtio-rng-device,rng=rng0   -device virtio-blk-device,drive=hd0   -drive file=fedora-rawhide-developer-20200108.n.0-sda.raw,format=raw,id=hd0   -device virtio-net-device,netdev=usernet   -netdev user,id=usernet,hostfwd=tcp::10000-:22
    

    Here are the captured results from running your benchmark script without the plots:

    [riscv@fedora-riscv rust-channel-benchmarks]$ time ./run.sh 
    + IFS='
    	'
    + SLEEP_SEC=2
    ++ dirname ./run.sh
    + cd .
    + rm -rf kanal2
    + git clone https://github.com/fereidani/kanal/ kanal2
    Cloning into 'kanal2'...
    remote: Enumerating objects: 486, done.
    remote: Counting objects: 100% (165/165), done.
    remote: Compressing objects: 100% (106/106), done.
    remote: Total 486 (delta 91), reused 94 (delta 59), pack-reused 321
    Receiving objects: 100% (486/486), 104.05 KiB | 569.00 KiB/s, done.
    Resolving deltas: 100% (325/325), done.
    + cargo clean
    + cargo update
        Updating crates.io index
        Updating git repository `https://github.com/fereidani/kanal`
    + mkdir -p target
    + cargo build --release --bin mpsc
      Downloaded futures-executor v0.3.25
      Downloaded lock_api v0.4.9
      Downloaded pin-utils v0.1.0
      Downloaded unicode-ident v1.0.5
      Downloaded tokio v1.21.2
      Downloaded cache-padded v1.2.0
      Downloaded autocfg v1.1.0
      Downloaded tokio-macros v1.8.0
      Downloaded syn v1.0.103
      Downloaded spin v0.9.4
      Downloaded slab v0.4.7
      Downloaded scopeguard v1.1.0
      Downloaded quote v1.0.21
      Downloaded proc-macro2 v1.0.47
      Downloaded pin-project-lite v0.2.9
      Downloaded pin-project-internal v1.0.12
      Downloaded pin-project v1.0.12
      Downloaded num_cpus v1.14.0
      Downloaded nanorand v0.7.0
      Downloaded memoffset v0.6.5
      Downloaded memchr v2.5.0
      Downloaded libc v0.2.137
      Downloaded getrandom v0.2.8
      Downloaded futures-util v0.3.25
      Downloaded futures-task v0.3.25
      Downloaded futures-sink v0.3.25
      Downloaded futures-macro v0.3.25
      Downloaded futures-io v0.3.25
      Downloaded futures-core v0.3.25
      Downloaded futures-channel v0.3.25
      Downloaded futures v0.3.25
      Downloaded flume v0.10.14
      Downloaded event-listener v2.5.3
      Downloaded crossbeam-utils v0.8.12
      Downloaded crossbeam-queue v0.3.6
      Downloaded crossbeam-epoch v0.9.11
      Downloaded crossbeam-deque v0.8.2
      Downloaded crossbeam-channel v0.5.6
      Downloaded crossbeam v0.8.2
      Downloaded concurrent-queue v1.2.4
      Downloaded cfg-if v1.0.0
      Downloaded async-channel v1.7.1
      Downloaded 42 crates (2.6 MB) in 12.86s
       Compiling autocfg v1.1.0
       Compiling proc-macro2 v1.0.47
       Compiling quote v1.0.21
       Compiling unicode-ident v1.0.5
       Compiling syn v1.0.103
       Compiling libc v0.2.137
       Compiling cfg-if v1.0.0
       Compiling scopeguard v1.1.0
       Compiling futures-core v0.3.25
       Compiling crossbeam-utils v0.8.12
       Compiling lock_api v0.4.9
       Compiling pin-project-lite v0.2.9
       Compiling memoffset v0.6.5
       Compiling slab v0.4.7
       Compiling futures-channel v0.3.25
       Compiling futures-sink v0.3.25
       Compiling memchr v2.5.0
       Compiling futures-task v0.3.25
       Compiling crossbeam-epoch v0.9.11
       Compiling futures-util v0.3.25
       Compiling num_cpus v1.14.0
       Compiling futures-io v0.3.25
       Compiling crossbeam-queue v0.3.6
       Compiling pin-utils v0.1.0
       Compiling getrandom v0.2.8
       Compiling tokio v1.21.2
       Compiling cache-padded v1.2.0
       Compiling concurrent-queue v1.2.4
       Compiling crossbeam-deque v0.8.2
       Compiling nanorand v0.7.0
       Compiling spin v0.9.4
       Compiling crossbeam-channel v0.5.6
       Compiling event-listener v2.5.3
       Compiling kanal v0.1.0-pre7 (https://github.com/fereidani/kanal#91cc83f3)
       Compiling async-channel v1.7.1
       Compiling crossbeam v0.8.2
       Compiling kanal v0.1.0-pre7 (/home/riscv/rust-channel-benchmarks/kanal2)
       Compiling futures-macro v0.3.25
       Compiling pin-project-internal v1.0.12
       Compiling tokio-macros v1.8.0
       Compiling pin-project v1.0.12
       Compiling flume v0.10.14
       Compiling futures-executor v0.3.25
       Compiling futures v0.3.25
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 11m 21s
    + cargo build --release --bin futures-channel
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 2m 56s
    + cargo build --release --bin flume
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 3m 09s
    + cargo build --release --bin flume-async
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 4m 35s
    + cargo build --release --bin crossbeam-channel
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 3m 12s
    + cargo build --release --bin async-channel
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 4m 16s
    + cargo build --release --bin kanal
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 3m 11s
    + cargo build --release --bin kanal-async
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 4m 58s
    + cargo build --release --bin kanal-std-mutex
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 3m 08s
    + cargo build --release --bin kanal-std-mutex-async
       Compiling benchmarks v0.1.0 (/home/riscv/rust-channel-benchmarks)
        Finished release [optimized] target(s) in 4m 43s
    + go build -o target/release/go_bench go.go
    + sleep 2
    + ./target/release/mpsc
    + tee target/mpsc.csv
    std::mpsc
    bounded0_mpsc(empty),107564651760,9297
    bounded0_spsc(empty),107437595508,9308
    bounded1_mpsc(empty),791989523,1262643
    bounded1_spsc(empty),697224042,1434259
    bounded_mpsc(empty),761494973,1313206
    bounded_seq(empty),868611946,1151262
    bounded_spsc(empty),601721413,1661899
    unbounded_mpsc(empty),680595652,1469301
    unbounded_seq(empty),792677122,1261548
    unbounded_spsc(empty),530956278,1883394
    bounded0_mpsc(usize),108578465369,9210
    bounded0_spsc(usize),112798930809,8865
    bounded1_mpsc(usize),770275368,1298237
    bounded1_spsc(usize),703723205,1421013
    bounded_mpsc(usize),804686982,1242719
    bounded_seq(usize),907442325,1101998
    bounded_spsc(usize),637548468,1568508
    unbounded_mpsc(usize),591746494,1689913
    unbounded_seq(usize),822832339,1215314
    unbounded_spsc(usize),507685466,1969724
    bounded0_mpsc(big),110645182713,9038
    bounded0_spsc(big),122402842927,8170
    bounded1_mpsc(big),1015858923,984389
    bounded1_spsc(big),877189211,1140005
    bounded_mpsc(big),1190420869,840039
    bounded_seq(big),1472503406,679116
    bounded_spsc(big),1163683030,859341
    unbounded_mpsc(big),799710276,1250453
    unbounded_seq(big),1351985004,739653
    unbounded_spsc(big),683559290,1462931
    + sleep 2
    + ./target/release/futures-channel
    + tee target/futures-channel.csv
    futures-channel
    bounded0_mpsc(empty),91342434329,10948
    bounded0_spsc(empty),336767713078,2969
    bounded1_mpsc(empty),71610917656,13964
    bounded1_spsc(empty),180414835855,5543
    bounded_mpsc(empty),1045348663,956619
    bounded_seq(empty),1555330523,642950
    bounded_spsc(empty),1210446934,826141
    unbounded_mpsc(empty),1070531259,934116
    unbounded_seq(empty),879370876,1137177
    unbounded_spsc(empty),1034163216,966965
    bounded0_mpsc(usize),92267169271,10838
    bounded0_spsc(usize),358359428359,2790
    bounded1_mpsc(usize),74241099461,13470
    bounded1_spsc(usize),182584790965,5477
    bounded_mpsc(usize),1085180502,921506
    bounded_seq(usize),1322668425,756047
    bounded_spsc(usize),1392051770,718364
    unbounded_mpsc(usize),1276505934,783388
    unbounded_seq(usize),891466321,1121747
    unbounded_spsc(usize),964654387,1036641
    bounded0_mpsc(big),92553782747,10805
    bounded0_spsc(big),341709445509,2926
    bounded1_mpsc(big),72033729035,13882
    bounded1_spsc(big),178323929034,5608
    bounded_mpsc(big),1120245423,892662
    bounded_seq(big),2098986823,476420
    bounded_spsc(big),1324105454,755227
    unbounded_mpsc(big),1084921117,921726
    unbounded_seq(big),1063596814,940206
    unbounded_spsc(big),1047554612,954604
    + sleep 2
    + ./target/release/flume
    + tee target/flume.csv
    flume
    bounded0_mpmc(empty),103383313186,9673
    bounded0_mpsc(empty),109072940317,9168
    bounded0_spsc(empty),133559914912,7487
    bounded1_mpmc(empty),88307852192,11324
    bounded1_mpsc(empty),98633328323,10139
    bounded1_spsc(empty),91758170956,10898
    bounded_mpmc(empty),1593413177,627584
    bounded_mpsc(empty),1216227041,822215
    bounded_seq(empty),642937439,1555361
    bounded_spsc(empty),1067693216,936599
    unbounded_mpmc(empty),1564465581,639196
    unbounded_mpsc(empty),1199051044,833993
    unbounded_seq(empty),604243021,1654963
    unbounded_spsc(empty),918248308,1089030
    bounded0_mpmc(usize),109493240016,9133
    bounded0_mpsc(usize),111430782310,8974
    bounded0_spsc(usize),135416046085,7385
    bounded1_mpmc(usize),86113784070,11613
    bounded1_mpsc(usize),96632636408,10348
    bounded1_spsc(usize),89694395240,11149
    bounded_mpmc(usize),1851286423,540165
    bounded_mpsc(usize),1301037341,768617
    bounded_seq(usize),591971377,1689271
    bounded_spsc(usize),1222418500,818050
    unbounded_mpmc(usize),1763066634,567194
    unbounded_mpsc(usize),1348795235,741402
    unbounded_seq(usize),579845054,1724599
    unbounded_spsc(usize),1223307000,817456
    bounded0_mpmc(big),111590669191,8961
    bounded0_mpsc(big),112300767485,8905
    bounded0_spsc(big),136607980741,7320
    bounded1_mpmc(big),94737069713,10556
    bounded1_mpsc(big),101255231519,9876
    bounded1_spsc(big),90540771092,11045
    bounded_mpmc(big),3789674317,263875
    bounded_mpsc(big),2294359507,435851
    bounded_seq(big),1663017238,601317
    bounded_spsc(big),2305894206,433671
    unbounded_mpmc(big),3910679801,255710
    unbounded_mpsc(big),2288965308,436879
    unbounded_seq(big),1612765044,620053
    unbounded_spsc(big),2242433514,445944
    + sleep 2
    + ./target/release/flume-async
    + tee target/flume_async.csv
    flume-async
    bounded0_mpmc(empty),21104961909,47382
    bounded0_mpsc(empty),14072288606,71062
    bounded0_spsc(empty),4727525498,211527
    bounded1_mpmc(empty),17584094659,56870
    bounded1_mpsc(empty),14281224780,70022
    bounded1_spsc(empty),4706333300,212480
    bounded_mpmc(empty),2375252797,421008
    bounded_mpsc(empty),1460296563,684792
    bounded_seq(empty),777122967,1286798
    bounded_spsc(empty),857369190,1166359
    unbounded_mpmc(empty),2242401014,445951
    unbounded_mpsc(empty),1434513017,697101
    unbounded_seq(empty),759552802,1316564
    unbounded_spsc(empty),842632125,1186758
    bounded0_mpmc(usize),20900469936,47846
    bounded0_mpsc(usize),13753397746,72709
    bounded0_spsc(usize),4898909376,204127
    bounded1_mpmc(usize),16939847340,59032
    bounded1_mpsc(usize),13333167900,75001
    bounded1_spsc(usize),4581115927,218287
    bounded_mpmc(usize),2424361594,412480
    bounded_mpsc(usize),1621996479,616524
    bounded_seq(usize),792841598,1261286
    bounded_spsc(usize),807143064,1238938
    unbounded_mpmc(usize),2464179692,405815
    unbounded_mpsc(usize),1638717378,610233
    unbounded_seq(usize),821446030,1217365
    unbounded_spsc(usize),813323930,1229522
    bounded0_mpmc(big),22347305424,44748
    bounded0_mpsc(big),16097084997,62123
    bounded0_spsc(big),5573986757,179405
    bounded1_mpmc(big),20259479216,49360
    bounded1_mpsc(big),15907418805,62864
    bounded1_spsc(big),5507165160,181582
    bounded_mpmc(big),4109821420,243320
    bounded_mpsc(big),2202975004,453932
    bounded_seq(big),1577676331,633844
    bounded_spsc(big),1171550199,853570
    unbounded_mpmc(big),3183508261,314119
    unbounded_mpsc(big),2199733104,454601
    unbounded_seq(big),1581185631,632437
    unbounded_spsc(big),1247239445,801771
    + sleep 2
    + ./target/release/crossbeam-channel
    + tee target/crossbeam-channel.csv
    crossbeam-channel
    bounded0_mpmc(empty),10834819427,92295
    bounded0_mpsc(empty),19123913165,52291
    bounded0_spsc(empty),7273852783,137479
    bounded1_mpmc(empty),867599094,1152606
    bounded1_mpsc(empty),710065735,1408320
    bounded1_spsc(empty),689155202,1451052
    bounded_mpmc(empty),505200002,1979414
    bounded_mpsc(empty),513020777,1949239
    bounded_seq(empty),713396701,1401745
    bounded_spsc(empty),466565959,2143320
    unbounded_mpmc(empty),383286433,2609015
    unbounded_mpsc(empty),402548262,2484174
    unbounded_seq(empty),663339071,1507525
    unbounded_spsc(empty),387965716,2577547
    bounded0_mpmc(usize),10746309331,93055
    bounded0_mpsc(usize),17067380255,58591
    bounded0_spsc(usize),8353199835,119715
    bounded1_mpmc(usize),697009769,1434700
    bounded1_mpsc(usize),654864171,1527034
    bounded1_spsc(usize),667178636,1498849
    bounded_mpmc(usize),461317339,2167705
    bounded_mpsc(usize),490942478,2036899
    bounded_seq(usize),703209702,1422051
    bounded_spsc(usize),452736320,2208791
    unbounded_mpmc(usize),441293140,2266067
    unbounded_mpsc(usize),409698162,2440821
    unbounded_seq(usize),661547421,1511607
    unbounded_spsc(usize),424254218,2357077
    bounded0_mpmc(big),10409415977,96067
    bounded0_mpsc(big),17110074675,58445
    bounded0_spsc(big),7438468355,134436
    bounded1_mpmc(big),803736717,1244189
    bounded1_mpsc(big),1063862936,939971
    bounded1_spsc(big),923948377,1082312
    bounded_mpmc(big),916241011,1091416
    bounded_mpsc(big),1033012438,968043
    bounded_seq(big),1334165520,749532
    bounded_spsc(big),1023236388,977291
    unbounded_mpmc(big),463014072,2159762
    unbounded_mpsc(big),1032184188,968819
    unbounded_seq(big),925064910,1081005
    unbounded_spsc(big),538306017,1857679
    + sleep 2
    + ./target/release/async-channel
    + tee target/async-channel.csv
    async-channel
    bounded1_mpmc(empty),44508966634,22467
    bounded1_mpsc(empty),19048380859,52498
    bounded1_spsc(empty),6021780539,166064
    bounded_mpmc(empty),1565567806,638746
    bounded_mpsc(empty),755252154,1324061
    bounded_seq(empty),576176615,1735579
    bounded_spsc(empty),525136018,1904269
    unbounded_mpmc(empty),898746279,1112661
    unbounded_mpsc(empty),773554619,1292734
    unbounded_seq(empty),652826310,1531801
    unbounded_spsc(empty),413984235,2415551
    bounded1_mpmc(usize),43548204291,22963
    bounded1_mpsc(usize),25715337260,38887
    bounded1_spsc(usize),6279360124,159252
    bounded_mpmc(usize),1299692322,769413
    bounded_mpsc(usize),595467964,1679351
    bounded_seq(usize),562053316,1779191
    bounded_spsc(usize),536331118,1864520
    unbounded_mpmc(usize),891563646,1121625
    unbounded_mpsc(usize),770712819,1297500
    unbounded_seq(usize),714841823,1398911
    unbounded_spsc(usize),430902254,2320712
    bounded1_mpmc(big),49973922340,20010
    bounded1_mpsc(big),30591085217,32689
    bounded1_spsc(big),7882019779,126871
    bounded_mpmc(big),1337299346,747776
    bounded_mpsc(big),1880182295,531863
    bounded_seq(big),1662225045,601603
    bounded_spsc(big),1403944846,712279
    unbounded_mpmc(big),874605430,1143373
    unbounded_mpsc(big),1239848446,806550
    unbounded_seq(big),1778380695,562309
    unbounded_spsc(big),2472811693,404398
    + sleep 2
    + ./target/release/kanal
    + tee target/kanal.csv
    kanal
    bounded0_mpmc(empty),9281025575,107747
    bounded0_mpsc(empty),10462581972,95579
    bounded0_spsc(empty),13716963363,72902
    bounded1_mpmc(empty),7498613679,133358
    bounded1_mpsc(empty),7752760179,128986
    bounded1_spsc(empty),8880470776,112607
    bounded_mpmc(empty),204621329,4887076
    bounded_mpsc(empty),133817645,7472856
    bounded_seq(empty),176360332,5670209
    bounded_spsc(empty),131577743,7600070
    unbounded_mpmc(empty),217210729,4603824
    unbounded_mpsc(empty),134878492,7414080
    unbounded_seq(empty),178388773,5605734
    unbounded_spsc(empty),129850168,7701184
    bounded0_mpmc(usize),10128855473,98728
    bounded0_mpsc(usize),10535298171,94919
    bounded0_spsc(usize),14136942162,70737
    bounded1_mpmc(usize),7316856080,136671
    bounded1_mpsc(usize),8175487078,122317
    bounded1_spsc(usize),11005606871,90863
    bounded_mpmc(usize),256918386,3892287
    bounded_mpsc(usize),147315770,6788139
    bounded_seq(usize),136589665,7321198
    bounded_spsc(usize),143049820,6990571
    unbounded_mpmc(usize),223505343,4474166
    unbounded_mpsc(usize),158738260,6299678
    unbounded_seq(usize),135088519,7402554
    unbounded_spsc(usize),145558877,6870072
    bounded0_mpmc(big),9870413325,101313
    bounded0_mpsc(big),9872532476,101291
    bounded0_spsc(big),14512055552,68908
    bounded1_mpmc(big),7078686570,141269
    bounded1_mpsc(big),8814788535,113446
    bounded1_spsc(big),9702204370,103069
    bounded_mpmc(big),694300525,1440298
    bounded_mpsc(big),657686675,1520481
    bounded_seq(big),594471697,1682166
    bounded_spsc(big),702989526,1422496
    unbounded_mpmc(big),278670998,3588461
    unbounded_mpsc(big),633999949,1577287
    unbounded_seq(big),599560222,1667889
    unbounded_spsc(big),261275485,3827378
    + sleep 2
    + ./target/release/kanal-async
    + tee target/kanal-async.csv
    kanal-async
    bounded0_mpmc(empty),2201182084,454301
    bounded0_mpsc(empty),2333618489,428519
    bounded0_spsc(empty),1885346821,530406
    bounded1_mpmc(empty),2038703578,490508
    bounded1_mpsc(empty),1851635920,540063
    bounded1_spsc(empty),2356394290,424377
    bounded_mpmc(empty),543743820,1839101
    bounded_mpsc(empty),690484925,1448258
    bounded_seq(empty),352443196,2837337
    bounded_spsc(empty),372479847,2684709
    unbounded_mpmc(empty),531509695,1881433
    unbounded_mpsc(empty),719028060,1390766
    unbounded_seq(empty),588862622,1698189
    unbounded_spsc(empty),676117925,1479032
    bounded0_mpmc(usize),2087004979,479156
    bounded0_mpsc(usize),2113472281,473155
    bounded0_spsc(usize),1753415416,570316
    bounded1_mpmc(usize),2047358378,488434
    bounded1_mpsc(usize),1807552319,553234
    bounded1_spsc(usize),1412413804,708008
    bounded_mpmc(usize),538368520,1857464
    bounded_mpsc(usize),432540696,2311921
    bounded_seq(usize),493096538,2028000
    bounded_spsc(usize),381536480,2620981
    unbounded_mpmc(usize),472784378,2115129
    unbounded_mpsc(usize),404274635,2473566
    unbounded_seq(usize),418740336,2388115
    unbounded_spsc(usize),424990696,2352993
    bounded0_mpmc(big),2653559401,376852
    bounded0_mpsc(big),2671001402,374391
    bounded0_spsc(big),2216513984,451159
    bounded1_mpmc(big),2801205607,356989
    bounded1_mpsc(big),2118478380,472037
    bounded1_spsc(big),2040569628,490059
    bounded_mpmc(big),1087519391,919524
    bounded_mpsc(big),1028353789,972428
    bounded_seq(big),826292097,1210226
    bounded_spsc(big),875975999,1141584
    unbounded_mpmc(big),1086940241,920014
    unbounded_mpsc(big),985594770,1014616
    unbounded_seq(big),1207398196,828227
    unbounded_spsc(big),815624930,1226054
    + sleep 2
    + ./target/release/kanal-std-mutex
    + tee target/kanal-std-mutex.csv
    kanal-std-mutex
    bounded0_mpmc(empty),7721400694,129510
    bounded0_mpsc(empty),10583532502,94486
    bounded0_spsc(empty),13224370403,75618
    bounded1_mpmc(empty),5704881317,175288
    bounded1_mpsc(empty),8742748033,114381
    bounded1_spsc(empty),8772857234,113988
    bounded_mpmc(empty),519751369,1923997
    bounded_mpsc(empty),409663295,2441029
    bounded_seq(empty),143552754,6966080
    bounded_spsc(empty),251535884,3975576
    unbounded_mpmc(empty),501921919,1992342
    unbounded_mpsc(empty),398332948,2510463
    unbounded_seq(empty),139534978,7166662
    unbounded_spsc(empty),253823034,3939753
    bounded0_mpmc(usize),7931757787,126075
    bounded0_mpsc(usize),9440882997,105922
    bounded0_spsc(usize),13530747337,73906
    bounded1_mpmc(usize),6315782404,158334
    bounded1_mpsc(usize),8647498296,115640
    bounded1_spsc(usize),8894800159,112425
    bounded_mpmc(usize),927828101,1077786
    bounded_mpsc(usize),565438518,1768539
    bounded_seq(usize),157523131,6348274
    bounded_spsc(usize),265174417,3771103
    unbounded_mpmc(usize),879563689,1136927
    unbounded_mpsc(usize),556787316,1796018
    unbounded_seq(usize),157066554,6366728
    unbounded_spsc(usize),272426831,3670710
    bounded0_mpmc(big),7857137096,127273
    bounded0_mpsc(big),9623213744,103915
    bounded0_spsc(big),13762072695,72663
    bounded1_mpmc(big),5846700785,171037
    bounded1_mpsc(big),8978588380,111376
    bounded1_spsc(big),9633686047,103802
    bounded_mpmc(big),1539792941,649438
    bounded_mpsc(big),1330574338,751555
    bounded_seq(big),619438757,1614365
    bounded_spsc(big),1100590829,908603
    unbounded_mpmc(big),891648892,1121518
    unbounded_mpsc(big),1112354882,898994
    unbounded_seq(big),663876368,1506305
    unbounded_spsc(big),462292757,2163131
    + sleep 2
    + ./target/release/kanal-std-mutex-async
    + tee target/kanal-std-mutex-async.csv
    kanal-std-mutex-async
    bounded0_mpmc(empty),3601828114,277637
    bounded0_mpsc(empty),1794702955,557195
    bounded0_spsc(empty),1592986154,627752
    bounded1_mpmc(empty),4529919851,220754
    bounded1_mpsc(empty),1466169722,682049
    bounded1_spsc(empty),1196767753,835584
    bounded_mpmc(empty),1117363683,894964
    bounded_mpsc(empty),798372069,1252549
    bounded_seq(empty),452708955,2208925
    bounded_spsc(empty),418758386,2388012
    unbounded_mpmc(empty),1139366739,877681
    unbounded_mpsc(empty),827226409,1208859
    unbounded_seq(empty),454438435,2200518
    unbounded_spsc(empty),444164572,2251418
    bounded0_mpmc(usize),3800481765,263125
    bounded0_mpsc(usize),2005321309,498673
    bounded0_spsc(usize),1591764654,628234
    bounded1_mpmc(usize),4903099145,203953
    bounded1_mpsc(usize),1668593824,599307
    bounded1_spsc(usize),1219786309,819816
    bounded_mpmc(usize),1354065694,738517
    bounded_mpsc(usize),1138683489,878207
    bounded_seq(usize),408217643,2449674
    bounded_spsc(usize),421309047,2373555
    unbounded_mpmc(usize),1444077967,692483
    unbounded_mpsc(usize),1150993492,868815
    unbounded_seq(usize),401902962,2488163
    unbounded_spsc(usize),441321872,2265920
    bounded0_mpmc(big),4139453751,241578
    bounded0_mpsc(big),2013092361,496748
    bounded0_spsc(big),1602589307,623990
    bounded1_mpmc(big),5450370985,183474
    bounded1_mpsc(big),1766552948,566074
    bounded1_spsc(big),1233161763,810924
    bounded_mpmc(big),1981781703,504596
    bounded_mpsc(big),1502666181,665484
    bounded_seq(big),865830519,1154960
    bounded_spsc(big),1433088564,697794
    unbounded_mpmc(big),1965306749,508826
    unbounded_mpsc(big),1498235230,667452
    unbounded_seq(big),868670586,1151184
    unbounded_spsc(big),857912117,1165621
    + sleep 2
    + ./target/release/go_bench
    + tee target/go.csv
    go chan1.12.2 gccgo (GCC) 9.2.1 20191120 (Red Hat 9.2.1-2)
    bounded0_mpmc(empty),146194658129,6840
    bounded0_mpsc(empty),205283386822,4871
    bounded0_spsc(empty),248615053654,4022
    bounded1_mpmc(empty),135297119267,7391
    bounded1_mpsc(empty),208195996834,4803
    bounded1_spsc(empty),173847096481,5752
    bounded_mpmc(empty),5165759437,193582
    bounded_mpsc(empty),4550099644,219775
    bounded_seq(empty),3990232652,250611
    bounded_spsc(empty),2768175066,361248
    bounded0_mpmc(usize),145045915331,6894
    bounded0_mpsc(usize),202120472236,4947
    bounded0_spsc(usize),242733182941,4119
    bounded1_mpmc(usize),129080399360,7747
    bounded1_mpsc(usize),193629038728,5164
    bounded1_spsc(usize),171030827827,5846
    bounded_mpmc(usize),6302574456,158665
    bounded_mpsc(usize),6181195856,161780
    bounded_seq(usize),4095749736,244155
    bounded_spsc(usize),3302786430,302774
    bounded0_mpmc(big),145818446404,6857
    bounded0_mpsc(big),201672608735,4958
    bounded0_spsc(big),240583941302,4156
    bounded1_mpmc(big),129676323734,7711
    bounded1_mpsc(big),191758429476,5214
    bounded1_spsc(big),168807917720,5923
    bounded_mpmc(big),7725062264,129448
    bounded_mpsc(big),6019998885,166112
    bounded_seq(big),5070648630,197213
    bounded_spsc(big),4399516520,227297
    + echo 'Test Environment:'
    Test Environment:
    + uname -srvp
    Linux 5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64 #1 SMP Mon Jan 6 17:31:22 UTC 2020 riscv64
    + rustc --version
    rustc 1.67.0-nightly (e9493d63c 2022-11-16)
    + go version
    go version go1.12.2 gccgo (GCC) 9.2.1 20191120 (Red Hat 9.2.1-2) linux/riscv64
    
    real	222m3.838s
    user	228m23.529s
    sys	212m32.487s
    
    benchmark 
    opened by omac777 3
  • Benchmarks on other silicon...

    Benchmarks on other silicon...

    opened by alphastrata 2
  • Are these benchmarks realistic?

    Are these benchmarks realistic?

    I put together benchmarks to compare kanal to other queues for batching and what I found was that kanal is considerably slower, making me wonder if any of these benchmarks are actually realistic as any real-world app wouldn't use a thread-per-core for running receivers and so you're basically testing under worst-case contention while overlooking how other designs compare, such as utilizing thread local channels to reduce contention. Here are the benchmarks that I created for this: https://github.com/Bajix/stack-queue/tree/features/kanal

    opened by Bajix 1
  • Consider adding thingbuf

    Consider adding thingbuf

    The thingbuf mpsc implementation is a lock-free array-based concurrent ring buffer that allows access to slots in the buffer by reference. It's also asynchronous and blocking bounded MPSC channels implemented using the ring buffer.

    Would be great to include this in the benchmark.

    opened by flxo 1
  • Fix SPSC and MPSC async benchmarks

    Fix SPSC and MPSC async benchmarks

    This PR fixes an important issue in the SPSC and MPSC benchmarks.

    The problem is that in these benchmarks, the receiver runs directly inside main instead of being spawned. With the #[tokio::main] macro, in practice this means that Tokio will run the receiver inside a block_on() call. This completely kills performance because block_on is just a thread-based primitive.

    The async performance of all channels is vastly improved after this fix, and their relative speed is affected.

    One problem though: for me kanal-async hangs 99% of the time in these benchmarks so I could not actually test the PR on kanal itself. I observed the same problem on Tachyobench (see my reddit comment). I will open a separate issue for that on the kanal repo.

    opened by sbarral 1
Owner
Khashayar Fereidani
Software Engineering M.Sc., Security Researcher, Full Stack Developer
Khashayar Fereidani
The Computer Language Benchmarks Game: Rust implementations

The Computer Language Benchmarks Game: Rust implementations This is the version I propose to the The Computer Language Benchmarks Game. For regex-dna,

Guillaume P. 69 Jul 11, 2022
Benchmarks of algorithms for convex min-plus convolutions

Convex min-plus convolution を実現するアルゴリズムの実行時間を比較します。 やり方 長さ N の convex な Vec<i32> を2本生成して、それらの min-plus convolution を3通りの方法で計算します。 brute: 定義どおり計算します。(Θ

Kana Nagata(長田歌菜) 2 Oct 24, 2021
Make a .scratch directory to keep random scribbles in

mkscratch Creates a directory named .scratch in your current working directory which will be ignored by Git. Useful for keeping around miscellaneous f

Kayla 3 Oct 21, 2022
Keep a Hetzner Cloud firewall up to date with your dynamic public IP address.

hcloud-firewall-controller hcloud-firewall-controller determines the current public IP and creates or updates a Hetzner Cloud firewall with this IP. S

Max Rosin 4 Feb 6, 2023
Shared Channel for WebAssembly

Shared Channel for WebAssembly This crate provides a way for WebAssembly threads to receive messages from other threads using a JavaScript primitive c

wasm.rs 27 Nov 24, 2022
A candidate backend for the Telegram channel @KonachanPopular

Konachan Popular (Rust) This repository contains the source code of the backend program running the Telegram channel @KonachanPopular. Run in a Contai

K4YT3X 10 Jan 3, 2023
Rust library for compiling and running other programs.

Exers ?? Exers is a rust library for compiling and running code in different languages and runtimes. Usage example fn main() { // Imports...

olix3001 5 Jun 10, 2023
A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments.

Zerokit A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments. Initial scope Focus on RLN

vac 44 Dec 27, 2022
👌 A smol functional language that targets other languages

ditto A small, pure functional language that targets other languages. Syntax highlighting coming soon Elevator pitch ⏱️ Ditto is a mashup of my favour

ditto 45 Dec 17, 2022
Compile-time stuff and other goodies for rustaceans 🦀

?? bagel: Always baked, never fried bagel is a collection of macros and other things that we frequently use at Skytable, primarily to get work done at

Skytable 3 Jul 4, 2022
Algebraic structures, higher-kinded types and other category theory bad ideas

Algar Algebric structures, higher-kinded types and other category theory bad ideas. Yes, you'll have generalized functors, applicatives, monads, trave

Stefano Candori 3 Jan 31, 2023
A mobile application platform for tertiary students to communicate, collaborate and share ideas with each other

Qreeket (pronounced "cricket") A mobile application platform for tertiary students to communicate, collaborate and share ideas with each other. As the

Quabynah Bilson Jr. 3 May 15, 2023
Modern Rust utility library delivering modularity, performance & extras; or simply Rust version of Lodash

Lorust - API Documentation Lorust is the Rust version of Lodash, which is a modern Javascript utilty library delivering modularity, performance & extr

Imamuzzaki Abu Salam 2 Jul 9, 2023
Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

co-rs 47 Nov 17, 2022
Stack heap flexible string designed to improve performance for Rust

flexible-string A stack heap flexible string designed to improve performance. FlexibleString was first implemented in spdlog-rs crate, which improved

Sprite 6 Feb 9, 2022
rusty-riscy is a performance testing and system resource monitoring tool written in Rust to benchmark RISC-V processors.

rusty-riscy rusty-riscy is a performance testing and system resource monitoring tool written in Rust to benchmark RISC-V processors. Objectives To cre

Suhas KV 4 May 3, 2022
An inquiry into nondogmatic software development. An experiment showing double performance of the code running on JVM comparing to equivalent native C code.

java-2-times-faster-than-c An experiment showing double performance of the code running on JVM comparing to equivalent native C code ⚠️ The title of t

xemantic 49 Aug 14, 2022
Nyah is a programming language runtime built for high performance and comes with a scripting language.

?? Nyah ( Unfinished ) Nyah is a programming language runtime built for high performance and comes with a scripting language. ??️ Status Nyah is not c

Stacker 3 Mar 6, 2022
Support SIMD low-memory overhead and high-performance adaptive radix tree.

Artful Artful is an adaptive radix tree library for Rust. At a high-level, it's like a BTreeMap. It is based on the implementation of paper, see The A

future 3 Sep 7, 2022