1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

sync/channels: provide `try_push(), try_pop() as public methods (#6101)

This commit is contained in:
Uwe Krüger
2020-08-10 18:06:42 +02:00
committed by GitHub
parent 36eae1c175
commit c3cdfa1c96
6 changed files with 82 additions and 17 deletions

View File

@ -0,0 +1,39 @@
# Channel Benchmark Results
This documents lists several benchmark results for different platforms in order to
identify performance regressions and improvements.
The are measured using the command
```
> channel_bench_* <nsend> <nrec> <buflen> <nobj>
nsend ... number of threads that push objects into the channel
nrec .... number of threads that pop objects from the channel
buflen .. length of channel buffer queue - `0` means unbuffered channel
nobj .... number of objects to pass thru the channel
```
## AMD Ryzen 7 3800X, Ubuntu-20.04 x86_64
10000000 Objects transfered, results in Objects/µs
| nsend | nrec | buflen | **V (gcc -O2)** | **V (tcc)** | **Go (glang)** | **Go (gccgo -O2)** |
| :---: | :---:| :---: | :---: | :---: | :---: | :---: |
| 1 | 1 | 0 | 0.95 | 0.66 | 4.65 | 0.56 |
| 1 | 1 | 100 | 3.26 | 2.24 | 18.90 | 6.08 |
| 4 | 4 | 0 | 0.25 | 0.24 | 1.84 | 0.84 |
| 4 | 4 | 100 | 2.78 | 2.63 | 7.43 | 3.71 |
## Raspberry Pi 3B+, Void Linux musl 32 bit
10000000 Objects transfered, results in Objects/µs
| nsend | nrec | buflen | **V (gcc -O2)** | **Go (glang)** |
| :---: | :---:| :---: | :---: | :---: |
| 1 | 1 | 0 | 0.37 | 0.21 |
| 1 | 1 | 100 | 1.03 | 0.74 |
| 4 | 4 | 0 | 0.04 | 0.38 |
| 4 | 4 | 100 | 2.78 | 2.63 |
| 2 | 2 | 0 | 0.05 | 0.38 |
| 2 | 2 | 100 | 1.26 | 0.75 |