Commit d852534
authored
Compile with
* Compile with `panic = "abort"`
This PR sets `panic = "abort"` for both debug and release builds.
This cuts down the `rerun` binary size in release builds from
29.9 MB to 22.7 MB - a 25% reduction!
## Details
The default panic behavior in Rust is to unwind the stack.
This leads to a lot of extra code bloat, and some missed
opportunities for optimization.
The benefit is that one can let a thread die without crashing the whole
application, and one can use `std::panic::catch_unwind` as a kind of
try-catch block.
We don't make use of these features at all (at least not intentionally),
and so are paying a cost for something we don't need.
I would also argue that a panic SHOULD lead to a hard crash unless
you are building an Erlang-like robust actor system where you use
defensive programming to protect against programmer errors
(all panics are programmer errors - user errors should use `Result`).
* Quiet clippypanic = "abort" (#1813)1 parent 49d5de8 commit d852534
3 files changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| |||
0 commit comments