Skip to content

Commit f564b6b

Browse files
committed
[STASH] Benchmarking
1 parent 728cab2 commit f564b6b

File tree

6 files changed

+157
-35
lines changed

6 files changed

+157
-35
lines changed

Cargo.lock

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ smallvec = "1.8.1"
2424

2525
[patch.crates-io]
2626
# Uncomment to use an unreleased version of cranelift
27-
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
28-
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
29-
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
30-
cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
31-
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
32-
cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
27+
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
28+
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
29+
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
30+
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
31+
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
32+
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
3333

3434
# Uncomment to use local checkout of cranelift
35-
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
36-
#cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
37-
#cranelift-module = { path = "../wasmtime/cranelift/module" }
38-
#cranelift-native = { path = "../wasmtime/cranelift/native" }
39-
#cranelift-jit = { path = "../wasmtime/cranelift/jit" }
40-
#cranelift-object = { path = "../wasmtime/cranelift/object" }
35+
cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
36+
cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
37+
cranelift-module = { path = "../wasmtime/cranelift/module" }
38+
cranelift-native = { path = "../wasmtime/cranelift/native" }
39+
cranelift-jit = { path = "../wasmtime/cranelift/jit" }
40+
cranelift-object = { path = "../wasmtime/cranelift/object" }
4141

4242
#gimli = { path = "../" }
4343

benchmark.txt

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
panic=abort
2+
Benchmark 1: cargo build
3+
Time (mean ± σ): 7.115 s ± 0.042 s [User: 20.655 s, System: 4.829 s]
4+
Range (min … max): 7.018 s … 7.164 s 10 runs
5+
6+
Benchmark 2: cargo-clif build
7+
Time (mean ± σ): 6.443 s ± 0.035 s [User: 16.163 s, System: 4.373 s]
8+
Range (min … max): 6.403 s … 6.509 s 10 runs
9+
10+
Benchmark 3: cargo-clif build --release
11+
Time (mean ± σ): 6.573 s ± 0.068 s [User: 17.793 s, System: 4.408 s]
12+
Range (min … max): 6.494 s … 6.688 s 10 runs
13+
14+
Summary
15+
'cargo-clif build' ran
16+
1.02 ± 0.01 times faster than 'cargo-clif build --release'
17+
1.10 ± 0.01 times faster than 'cargo build'
18+
19+
panic=unwind baseline
20+
Benchmark 1: cargo build
21+
Time (mean ± σ): 7.148 s ± 0.112 s [User: 20.688 s, System: 4.807 s]
22+
Range (min … max): 7.049 s … 7.418 s 10 runs
23+
24+
Benchmark 2: cargo-clif build
25+
Time (mean ± σ): 7.484 s ± 0.050 s [User: 20.919 s, System: 4.878 s]
26+
Range (min … max): 7.413 s … 7.566 s 10 runs
27+
28+
Benchmark 3: cargo-clif build --release
29+
Time (mean ± σ): 7.536 s ± 0.041 s [User: 22.934 s, System: 4.910 s]
30+
Range (min … max): 7.490 s … 7.625 s 10 runs
31+
32+
Summary
33+
'cargo build' ran
34+
1.05 ± 0.02 times faster than 'cargo-clif build'
35+
1.05 ± 0.02 times faster than 'cargo-clif build --release'
36+
Benchmark 1: ./raytracer_cg_llvm
37+
Time (mean ± σ): 6.231 s ± 0.034 s [User: 6.223 s, System: 0.007 s]
38+
Range (min … max): 6.191 s … 6.282 s 10 runs
39+
40+
Benchmark 2: ./raytracer_cg_clif
41+
Time (mean ± σ): 5.342 s ± 0.003 s [User: 5.335 s, System: 0.006 s]
42+
Range (min … max): 5.338 s … 5.347 s 10 runs
43+
44+
Benchmark 3: ./raytracer_cg_clif_opt
45+
Time (mean ± σ): 4.228 s ± 0.004 s [User: 4.222 s, System: 0.007 s]
46+
Range (min … max): 4.224 s … 4.234 s 10 runs
47+
48+
Summary
49+
'./raytracer_cg_clif_opt' ran
50+
1.26 ± 0.00 times faster than './raytracer_cg_clif'
51+
1.47 ± 0.01 times faster than './raytracer_cg_llvm'
52+
53+
panic=unwind optimized exception storage
54+
Benchmark 1: cargo build
55+
Time (mean ± σ): 7.104 s ± 0.078 s [User: 20.688 s, System: 4.803 s]
56+
Range (min … max): 6.999 s … 7.273 s 10 runs
57+
58+
Benchmark 2: cargo-clif build
59+
Time (mean ± σ): 7.473 s ± 0.031 s [User: 20.838 s, System: 4.868 s]
60+
Range (min … max): 7.435 s … 7.524 s 10 runs
61+
62+
Benchmark 3: cargo-clif build --release
63+
Time (mean ± σ): 7.512 s ± 0.052 s [User: 22.855 s, System: 4.887 s]
64+
Range (min … max): 7.437 s … 7.605 s 10 runs
65+
66+
Summary
67+
'cargo build' ran
68+
1.05 ± 0.01 times faster than 'cargo-clif build'
69+
1.06 ± 0.01 times faster than 'cargo-clif build --release'
70+
Benchmark 1: ./raytracer_cg_llvm
71+
Time (mean ± σ): 6.231 s ± 0.039 s [User: 6.222 s, System: 0.009 s]
72+
Range (min … max): 6.190 s … 6.315 s 10 runs
73+
74+
Benchmark 2: ./raytracer_cg_clif
75+
Time (mean ± σ): 5.179 s ± 0.003 s [User: 5.172 s, System: 0.007 s]
76+
Range (min … max): 5.173 s … 5.186 s 10 runs
77+
78+
Benchmark 3: ./raytracer_cg_clif_opt
79+
Time (mean ± σ): 4.154 s ± 0.010 s [User: 4.147 s, System: 0.007 s]
80+
Range (min … max): 4.139 s … 4.162 s 10 runs
81+
82+
Summary
83+
'./raytracer_cg_clif_opt' ran
84+
1.25 ± 0.00 times faster than './raytracer_cg_clif'
85+
1.50 ± 0.01 times faster than './raytracer_cg_llvm'
86+
87+
panic=unwind is_included_in_clobbers fix
88+
Benchmark 1: cargo build
89+
Time (mean ± σ): 7.051 s ± 0.051 s [User: 20.682 s, System: 4.771 s]
90+
Range (min … max): 6.974 s … 7.130 s 10 runs
91+
92+
Benchmark 2: cargo-clif build
93+
Time (mean ± σ): 7.539 s ± 0.053 s [User: 21.069 s, System: 4.806 s]
94+
Range (min … max): 7.452 s … 7.625 s 10 runs
95+
96+
Benchmark 3: cargo-clif build --release
97+
Time (mean ± σ): 7.580 s ± 0.038 s [User: 23.051 s, System: 4.872 s]
98+
Range (min … max): 7.525 s … 7.654 s 10 runs
99+
100+
Summary
101+
'cargo build' ran
102+
1.07 ± 0.01 times faster than 'cargo-clif build'
103+
1.08 ± 0.01 times faster than 'cargo-clif build --release'
104+
[BENCH RUN] ebobby/simple-raytracer
105+
Benchmark 1: ./raytracer_cg_llvm
106+
Time (mean ± σ): 6.185 s ± 0.029 s [User: 6.178 s, System: 0.006 s]
107+
Range (min … max): 6.152 s … 6.228 s 10 runs
108+
109+
Benchmark 2: ./raytracer_cg_clif
110+
Time (mean ± σ): 5.090 s ± 0.013 s [User: 5.080 s, System: 0.009 s]
111+
Range (min … max): 5.067 s … 5.111 s 10 runs
112+
113+
Benchmark 3: ./raytracer_cg_clif_opt
114+
Time (mean ± σ): 4.074 s ± 0.008 s [User: 4.067 s, System: 0.007 s]
115+
Range (min … max): 4.063 s … 4.092 s 10 runs
116+
117+
Summary
118+
'./raytracer_cg_clif_opt' ran
119+
1.25 ± 0.00 times faster than './raytracer_cg_clif'
120+
1.52 ± 0.01 times faster than './raytracer_cg_llvm'

cleanup_example.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
struct DropBomb;
2+
3+
impl Drop for DropBomb {
4+
fn drop(&mut self) {
5+
std::process::abort();
6+
}
7+
}
8+
9+
#[inline(never)]
10+
fn bar() {}
11+
12+
pub fn main() {
13+
let a = DropBomb;
14+
bar();
15+
std::mem::forget(a);
16+
}

src/abi/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,10 @@ pub(crate) fn codegen_call_with_unwind_action(
891891
}
892892

893893
match unwind {
894-
UnwindAction::Continue | UnwindAction::Unreachable => {
894+
UnwindAction::Continue
895+
| UnwindAction::Unreachable
896+
| UnwindAction::Cleanup(_)
897+
| UnwindAction::Terminate(_) => {
895898
let call_inst = match func_ref {
896899
CallTarget::Direct(func_ref) => fx.bcx.ins().call(func_ref, &call_args),
897900
CallTarget::Indirect(sig, func_ptr) => {
@@ -935,10 +938,10 @@ pub(crate) fn codegen_call_with_unwind_action(
935938
let exception_table = fx.bcx.func.dfg.exception_tables.push(ExceptionTableData::new(
936939
sig_ref,
937940
fallthrough_block_call,
938-
[(
941+
[/*(
939942
Some(ExceptionTag::with_number(EXCEPTION_HANDLER_CLEANUP).unwrap()),
940943
pre_cleanup_block_call,
941-
)],
944+
)*/],
942945
));
943946

944947
match func_ref {
@@ -953,7 +956,7 @@ pub(crate) fn codegen_call_with_unwind_action(
953956
fx.bcx.seal_block(pre_cleanup_block);
954957
fx.bcx.switch_to_block(pre_cleanup_block);
955958
fx.bcx.set_cold_block(pre_cleanup_block);
956-
match unwind {
959+
/*match unwind {
957960
UnwindAction::Continue | UnwindAction::Unreachable => unreachable!(),
958961
UnwindAction::Cleanup(cleanup) => {
959962
let exception_ptr =
@@ -968,7 +971,7 @@ pub(crate) fn codegen_call_with_unwind_action(
968971
969972
codegen_unwind_terminate(fx, span, reason);
970973
}
971-
}
974+
}*/
972975

973976
if target_block.is_none() {
974977
fx.bcx.seal_block(fallthrough_block);

src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
300300
}
301301

302302
if bb_data.is_cleanup {
303-
if cfg!(not(feature = "unwinding")) {
303+
if true || cfg!(not(feature = "unwinding")) {
304304
continue;
305305
}
306306

0 commit comments

Comments
 (0)