-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCargo.toml
63 lines (56 loc) · 2.46 KB
/
Cargo.toml
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
[package]
name = "stc"
version = "0.1.0"
authors = ["Mitchell Tishmack <[email protected]>"]
edition = "2018"
build = "build.rs"
[lib]
name = "stc"
path = "src/lib.rs"
[[bin]]
name = "stc"
path = "src/stc.rs"
[dependencies]
clap = "2.33"
[build-dependencies]
vergen = "3.0"
# Release profile is optimized for output size. only "questionable" one is the
# panic setting imo, it kills the backtrace but reduces huge binary sizes
#
# a basic clap binary goes from about 1MiB to about 600k, so... seems worth it
#
# Most of the "bloat" here is going to be .text being format strings and whatnot.
# Example:
# $ nix-shell -p cargo -p cargo-bloat --run 'cargo bloat --release'
# Finished release [optimized] target(s) in 0.02s
# Analyzing target/release/stc
# File .text Size Crate Name
# 3.2% 5.9% 18.9KiB clap clap::app::parser::Parser::get_matches_with
# 2.1% 3.9% 12.5KiB clap clap::app::validator::Validator::validate
# 1.8% 3.3% 10.4KiB [Unknown] elf_add
# 1.7% 3.2% 10.2KiB clap clap::app::help::Help::write_arg
# 1.6% 2.9% 9.2KiB [Unknown] dwarf_lookup_pc
# 1.3% 2.4% 7.6KiB std __rdos_backtrace_dwarf_add
# 1.3% 2.3% 7.4KiB clap clap::app::help::Help::_write_parser_help
# 1.1% 2.0% 6.4KiB clap core::num::dec2flt::dec2flt
# 0.9% 1.7% 5.5KiB clap clap::app::usage::get_required_usage_from
# 0.8% 1.4% 4.6KiB [Unknown] elf_zlib_inflate
# 0.7% 1.3% 4.0KiB std rustc_demangle::v0::Printer::print_type
# 0.7% 1.2% 4.0KiB clap clap::app::usage::create_help_usage
# 0.6% 1.2% 3.8KiB std <backtrace::symbolize::SymbolName as core::fmt::Display>::fmt
# 0.6% 1.2% 3.8KiB clap clap::app::help::Help::write_subcommands
# 0.6% 1.2% 3.7KiB clap? <clap::app::parser::Parser as core::clone::Clone>::clone
# 0.6% 1.1% 3.5KiB std rustc_demangle::try_demangle
# 0.6% 1.1% 3.4KiB [Unknown] read_function_entry
# 0.5% 0.9% 3.0KiB clap clap::app::help::Help::write_all_args
# 0.5% 0.9% 2.9KiB std std::sys_common::backtrace::output_filename
# 0.4% 0.8% 2.6KiB stc stc::main
# 32.2% 59.3% 189.8KiB And 1055 smaller methods. Use -n N to show more.
# 54.3% 100.0% 320.2KiB .text section size, the file size is 589.5KiB
#
# Getting things much smaller than this isn't really worth it, this'll do for now.
[profile.release]
codegen-units = 1
lto = true
opt-level = 'z'
panic = 'abort'