Skip to content

Commit b37fc91

Browse files
committed
Add shell of benchmarks and update our CI bench code.
1 parent dc77eb5 commit b37fc91

File tree

2 files changed

+87
-122
lines changed

2 files changed

+87
-122
lines changed

.github/workflows/bench.yml

Lines changed: 18 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ jobs:
3535
run: wmic cpu list /format:list
3636
shell: bash
3737

38-
# TODO: Restore later
3938
- run: cargo --version
4039
- run: cmake --version
4140

4241
# RUST
4342

44-
# TODO: Add the rust stuff right here
4543
- run: |
4644
cd extras/simple-bench
4745
cargo build --release
@@ -50,139 +48,43 @@ jobs:
5048
- run: |
5149
cd extras/simple-bench
5250
cargo run --release -- file ext/data/canada.txt
53-
name: Bench Canada Rust
54-
shell: bash
55-
56-
- run: |
57-
cd extras/simple-bench
5851
cargo run --release -- file ext/data/mesh.txt
59-
name: Bench Mesh Rust
60-
shell: bash
61-
62-
- run: |
63-
cd extras/simple-bench
6452
cargo run --release -- random uniform
65-
name: Bench Uniform Rust
66-
shell: bash
67-
68-
- run: |
69-
cd extras/simple-bench
7053
cargo run --release -- random one_over_rand32
71-
name: Bench 1/Rand32 Rust
72-
shell: bash
73-
74-
- run: |
75-
cd extras/simple-bench
7654
cargo run --release -- random simple_uniform32
77-
name: Bench Simple Uniform 32 Rust
78-
shell: bash
79-
80-
- run: |
81-
cd extras/simple-bench
8255
cargo run --release -- random simple_int32
83-
name: Bench Simple Int 32 Rust
84-
shell: bash
85-
86-
- run: |
87-
cd extras/simple-bench
8856
cargo run --release -- random simple_int64
89-
name: Bench Simple Int 64 Rust
90-
shell: bash
91-
92-
- run: |
93-
cd extras/simple-bench
9457
cargo run --release -- random int_e_int
95-
name: Bench Int e Int Rust
96-
shell: bash
97-
98-
- run: |
99-
cd extras/simple-bench
10058
cargo run --release -- random int_e_int
101-
name: Bench Int e Int Rust
102-
shell: bash
103-
104-
- run: |
105-
cd extras/simple-bench
10659
cargo run --release -- random bigint_int_dot_int
107-
name: Bench Big Int.Int Rust
108-
shell: bash
109-
110-
- run: |
111-
cd extras/simple-bench
11260
cargo run --release -- random big_ints
113-
name: Bench Big Ints Rust
61+
name: Bench Rust
11462
shell: bash
11563
11664
# C++
11765

11866
- run: |
11967
cd extras/simple-bench/ext
120-
cmake -B build .
68+
cmake -DCMAKE_BUILD_TYPE=Release -B build .
12169
cmake --build build --config Release
12270
name: Build C/C++
12371
12472
- run: |
12573
cd extras/simple-bench/ext
126-
build/benchmarks/benchmark -f data/canada.txt
127-
name: Bench Canada C/C++
128-
shell: bash
129-
130-
- run: |
131-
cd extras/simple-bench/ext
132-
build/benchmarks/benchmark -f data/mesh.txt
133-
name: Bench Mesh C/C++
134-
shell: bash
135-
136-
- run: |
137-
cd extras/simple-bench/ext
138-
build/benchmarks/benchmark -m uniform
139-
name: Bench Uniform C/C++
140-
shell: bash
141-
142-
- run: |
143-
cd extras/simple-bench/ext
144-
build/benchmarks/benchmark -m one_over_rand32
145-
name: Bench 1/Rand32 C/C++
146-
shell: bash
147-
148-
- run: |
149-
cd extras/simple-bench/ext
150-
build/benchmarks/benchmark -m simple_uniform32
151-
name: Bench Simple Uniform 32 C/C++
152-
shell: bash
153-
154-
- run: |
155-
cd extras/simple-bench/ext
156-
build/benchmarks/benchmark -m simple_int32
157-
name: Bench Simple Int 32 C/C++
158-
shell: bash
159-
160-
- run: |
161-
cd extras/simple-bench/ext
162-
build/benchmarks/benchmark -m simple_int64
163-
name: Bench Simple Int 64 C/C++
164-
shell: bash
165-
166-
- run: |
167-
cd extras/simple-bench/ext
168-
build/benchmarks/benchmark -m int_e_int
169-
name: Bench Int e Int C/C++
170-
shell: bash
171-
172-
- run: |
173-
cd extras/simple-bench/ext
174-
build/benchmarks/benchmark -m int_e_int
175-
name: Bench Int e Int C/C++
176-
shell: bash
177-
178-
- run: |
179-
cd extras/simple-bench/ext
180-
build/benchmarks/benchmark -m bigint_int_dot_int
181-
name: Bench Big Int.Int C/C++
182-
shell: bash
183-
184-
- run: |
185-
cd extras/simple-bench/ext
186-
build/benchmarks/benchmark -m big_ints
187-
name: Bench Big Ints C/C++
74+
if [[ -f build/benchmarks/Release/benchmark.exe ]]; then
75+
exe=build/benchmarks/Release/benchmark.exe
76+
else
77+
exe=build/benchmarks/benchmark
78+
fi
79+
"${exe}" -f data/canada.txt
80+
"${exe}" -f data/mesh.txt
81+
"${exe}" -m uniform
82+
"${exe}" -m one_over_rand32
83+
"${exe}" -m simple_uniform32
84+
"${exe}" -m simple_int32
85+
"${exe}" -m simple_int64
86+
"${exe}" -m int_e_int
87+
"${exe}" -m bigint_int_dot_int
88+
"${exe}" -m big_ints
89+
name: Bench C/C++
18890
shell: bash

README.md

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,82 @@ into a 64-bit float (using the median score).
109109

110110
### Intel i7-14700K
111111

112-
Intel i7-14700K 3.40GHz, Linux (WSL2), Rust 1.81.
112+
- CPU: Intel i7-14700K 3.40GHz
113+
- OS: Ubuntu 24.04 (WSL2)
114+
- Rust: 1.81
115+
- C++: GCC 13.2.0
113116

114117
| | `canada` | `mesh` | `uniform` | `bi` | `iei` | `rec32` |
115118
| ---------------------- | -------- | -------- | --------- | ----- | ------ | ------- |
116119
| fast-float2 | 9.98 | 5.56 | 10.08 | 56.19 | 14.52 | 15.09 |
117120
| fast-float | 9.77 | 5.04 | 9.05 | 57.52 | 14.40 | 14.23 |
118121
| lexical | 10.62 | 4.93 | 9.92 | 26.40 | 12.43 | 14.40 |
119122
| from_str | 11.59 | 5.92 | 11.23 | 35.92 | 14.75 | 16.76 |
120-
| fast_float (C++) | 12.58 | 6.35 | 11.86 | 31.55 | 12.22 | 11.97 |
121-
| abseil (C++) | 25.32 | 15.70 | 25.88 | 43.42 | 23.54 | 26.75 |
122-
| netlib (C) | 35.10 | 10.22 | 37.72 | 68.63 | 23.07 | 38.23 |
123-
| strtod (C) | 52.63 | 26.47 | 46.51 | 88.11 | 33.37 | 53.36 |
124-
| doubleconversion (C++) | 32.50 | 14.69 | 47.80 | 70.01 | 205.72 | 45.66 |
123+
| fast_float (C++) | 12.58 | 6.35 | 11.86 | 31.55 | 12.22 | 11.97 |
124+
| abseil (C++) | 25.32 | 15.70 | 25.88 | 43.42 | 23.54 | 26.75 |
125+
| netlib (C) | 35.10 | 10.22 | 37.72 | 68.63 | 23.07 | 38.23 |
126+
| strtod (C) | 52.63 | 26.47 | 46.51 | 88.11 | 33.37 | 53.36 |
127+
| doubleconversion (C++) | 32.50 | 14.69 | 47.80 | 70.01 | 205.72 | 45.66 |
128+
129+
### AMD EPYC 7763 64-Core Processor (Linux)
130+
131+
- CPU: AMD EPYC 7763 64-Core Processor 3.20GHz
132+
- OS: Ubuntu 24.04 (WSL2)
133+
- Rust: 1.83
134+
- C++: GCC 13.2.0
135+
- Environment: Github Actions
136+
137+
| | `canada` | `mesh` | `uniform` | `bi` | `iei` | `rec32` |
138+
| ---------------------- | -------- | -------- | --------- | ----- | ------ | ------- |
139+
| fast-float2 | | | | | | |
140+
| fast-float | | | | | | |
141+
| lexical | | | | | | |
142+
| from_str | | | | | | |
143+
| fast_float (C++) | | | | | | |
144+
| abseil (C++) | | | | | | |
145+
| netlib (C) | | | | | | |
146+
| strtod (C) | | | | | | |
147+
| doubleconversion (C++) | | | | | | |
148+
149+
### AMD EPYC 7763 64-Core Processor (Windows)
150+
151+
- CPU: AMD EPYC 7763 64-Core Processor 3.20GHz
152+
- OS: Ubuntu 24.04 (WSL2)
153+
- Rust: 1.83
154+
- C++: GCC 13.2.0
155+
- Environment: Github Actions
156+
157+
| | `canada` | `mesh` | `uniform` | `bi` | `iei` | `rec32` |
158+
| ---------------------- | -------- | -------- | --------- | ----- | ------ | ------- |
159+
| fast-float2 | | | | | | |
160+
| fast-float | | | | | | |
161+
| lexical | | | | | | |
162+
| from_str | | | | | | |
163+
| fast_float (C++) | | | | | | |
164+
| abseil (C++) | | | | | | |
165+
| netlib (C) | | | | | | |
166+
| strtod (C) | | | | | | |
167+
| doubleconversion (C++) | | | | | | |
168+
169+
### Apple M1 (macOS)
170+
171+
- CPU: AMD EPYC 7763 64-Core Processor 3.20GHz
172+
- OS: Ubuntu 24.04 (WSL2)
173+
- Rust: 1.83
174+
- C++: GCC 13.2.0
175+
- Environment: Github Actions
176+
177+
| | `canada` | `mesh` | `uniform` | `bi` | `iei` | `rec32` |
178+
| ---------------------- | -------- | -------- | --------- | ----- | ------ | ------- |
179+
| fast-float2 | | | | | | |
180+
| fast-float | | | | | | |
181+
| lexical | | | | | | |
182+
| from_str | | | | | | |
183+
| fast_float (C++) | | | | | | |
184+
| abseil (C++) | | | | | | |
185+
| netlib (C) | | | | | | |
186+
| strtod (C) | | | | | | |
187+
| doubleconversion (C++) | | | | | | |
125188

126189
Note that the random number generation seems to differ between C/C++ and Rust, since the Rust implementations are slightly faster for pre-determined datasets like `canada` and `mesh`, but equivalent random number generators are slightly slower. Any performance penalty with `fast-float2` occurred due to fixing the UB in [check_len](https://github.com/aldanor/fast-float-rust/issues/28). The massive performance differences between `fast-float` (Rust) and `fast_float` (C++) are expected due to a faster fallback algorithms ([#96](https://github.com/fastfloat/fast_float/pull/96) and [#104](https://github.com/fastfloat/fast_float/pull/104)) used in these cases.
127190

0 commit comments

Comments
 (0)