summaryrefslogtreecommitdiff
path: root/skip/ripgrep/minimize-size.patch
blob: dbb008b550c41a688e85601a8fd40cb46bde2940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Tue, 6 Apr 2021 00:24:00 +0200
Subject: [PATCH] Reduce size of the binary

Reduce size of the resulting binary: 4.6 -> 3.0 MiB (on x86_64).

`opt-level="s"` provides the best size/performance ratio; the performance
is close to the default opt-level (according to the benchmark), but the
binary is significantly smaller.

NOTE: ripgrep uses jemalloc allocator when building on musl libc.
It adds about 200 kiB to the binary size, but provides 2x performance;
so better keep it as-is.

--- a/Cargo.toml
+++ b/Cargo.toml
@@ -78,7 +78,10 @@
 pcre2 = ["grep/pcre2"]
 
 [profile.release]
-debug = 1
+lto = true
+codegen-units = 1
+panic = "abort"
+opt-level = "s"
 
 [package.metadata.deb]
 features = ["pcre2"]