upgrade, update, and use mold+clang

This commit is contained in:
Bryan Stitt 2023-11-14 14:48:37 -08:00
parent c4afad5b49
commit 0d060033d0
7 changed files with 146 additions and 112 deletions

@ -1,5 +1,7 @@
[build]
rustflags = [
# potentially faster. https://github.com/aws/aws-graviton-getting-started/blob/main/rust.md
"-C", "target-feature=+lse",
# potentially faster. https://nnethercote.github.io/perf-book/build-configuration.html
"-C", "target-cpu=native",
# tokio unstable is needed for tokio-console
@ -8,6 +10,8 @@ rustflags = [
"--cfg", "uuid_unstable",
]
rustdocflags = [
# potentially faster. https://github.com/aws/aws-graviton-getting-started/blob/main/rust.md
"-C", "target-feature=+lse",
# potentially faster. https://nnethercote.github.io/perf-book/build-configuration.html
"-C", "target-cpu=native",
# tokio unstable is needed for tokio-console

196
Cargo.lock generated

@ -538,47 +538,26 @@ dependencies = [
[[package]]
name = "borsh"
version = "0.10.3"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b"
checksum = "bf617fabf5cdbdc92f774bfe5062d870f228b80056d41180797abf48bed4056e"
dependencies = [
"borsh-derive",
"hashbrown 0.13.2",
"cfg_aliases",
]
[[package]]
name = "borsh-derive"
version = "0.10.3"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7"
dependencies = [
"borsh-derive-internal",
"borsh-schema-derive-internal",
"proc-macro-crate 0.1.5",
"proc-macro2",
"syn 1.0.109",
]
[[package]]
name = "borsh-derive-internal"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb"
checksum = "f404657a7ea7b5249e36808dff544bc88a28f26e0ac40009f674b7a009d14be3"
dependencies = [
"once_cell",
"proc-macro-crate 2.0.0",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.39",
"syn_derive",
]
[[package]]
@ -734,6 +713,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "chrono"
version = "0.4.31"
@ -778,9 +763,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.4.7"
version = "4.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b"
checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64"
dependencies = [
"clap_builder",
"clap_derive 4.4.7",
@ -788,9 +773,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.4.7"
version = "4.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663"
checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc"
dependencies = [
"anstream",
"anstyle",
@ -1176,9 +1161,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "crypto-bigint"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124"
checksum = "28f85c3514d2a6e64160359b45a3918c3b4178bcbf4ae5d03ab2d02e521c479a"
dependencies = [
"generic-array",
"rand_core 0.6.4",
@ -1534,9 +1519,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.10.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
dependencies = [
"humantime",
"is-terminal",
@ -2333,15 +2318,6 @@ dependencies = [
"ahash 0.7.7",
]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.6",
]
[[package]]
name = "hashbrown"
version = "0.14.2"
@ -2373,9 +2349,9 @@ dependencies = [
[[package]]
name = "hdrhistogram"
version = "7.5.2"
version = "7.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8"
checksum = "a5b38e5c02b7c7be48c8dc5217c4f1634af2ea221caae2e024bffc7a7651c691"
dependencies = [
"base64 0.13.1",
"byteorder",
@ -2492,9 +2468,9 @@ dependencies = [
[[package]]
name = "http"
version = "0.2.9"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
dependencies = [
"bytes",
"fnv",
@ -2834,6 +2810,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.9"
@ -3864,15 +3849,6 @@ dependencies = [
"uint",
]
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml 0.5.11",
]
[[package]]
name = "proc-macro-crate"
version = "1.3.1"
@ -3933,9 +3909,9 @@ dependencies = [
[[package]]
name = "proptest"
version = "1.3.1"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e"
checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf"
dependencies = [
"bitflags 2.4.1",
"lazy_static",
@ -3943,7 +3919,7 @@ dependencies = [
"rand 0.8.5",
"rand_chacha 0.3.1",
"rand_xorshift",
"regex-syntax 0.7.5",
"regex-syntax 0.8.2",
"unarray",
]
@ -4483,9 +4459,9 @@ dependencies = [
[[package]]
name = "rust_decimal"
version = "1.32.0"
version = "1.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd"
checksum = "076ba1058b036d3ca8bcafb1d54d0b0572e99d7ecd3e4222723e18ca8e9ca9a8"
dependencies = [
"arrayvec",
"borsh",
@ -4520,9 +4496,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.21"
version = "0.38.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
checksum = "ffb93593068e9babdad10e4fce47dc9b3ac25315a72a59766ffd9e9a71996a04"
dependencies = [
"bitflags 2.4.1",
"errno",
@ -4680,9 +4656,9 @@ dependencies = [
[[package]]
name = "sea-orm"
version = "0.12.4"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14d17105eb8049488d2528580ecc3f0912ab177d600f10e8e292d6994870ba6a"
checksum = "44681cfb3fb28be7cd0b170a819e83938e47eb846007c94ca1350b987ee48e0b"
dependencies = [
"async-stream",
"async-trait",
@ -4708,12 +4684,12 @@ dependencies = [
[[package]]
name = "sea-orm-cli"
version = "0.12.4"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66b46c28caf05824ecd1e68865de762959aa3640e1c21a415a00090e67b1658"
checksum = "507c2b99f83129f4d5d511012ab47c9f40d1c7923fd4698c19fae23f0bf62913"
dependencies = [
"chrono",
"clap 4.4.7",
"clap 4.4.8",
"dotenvy",
"glob",
"regex",
@ -4725,9 +4701,9 @@ dependencies = [
[[package]]
name = "sea-orm-macros"
version = "0.12.5"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a836864040c92d0615497eeccf97e1aee312857bf2ab36d74a74ce1c5c2cefc3"
checksum = "816183a751bf9c22087679b20b6142da0b5c6d8981835ebb7b99bf1bf924640a"
dependencies = [
"heck",
"proc-macro2",
@ -4739,12 +4715,12 @@ dependencies = [
[[package]]
name = "sea-orm-migration"
version = "0.12.4"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a340d727bafe3d817b55f920498cc469e8664e8b654017d2ec93a31aed40b70f"
checksum = "9d45937e5d4869a0dcf0222bb264df564c077cbe9b312265f3717401d023a633"
dependencies = [
"async-trait",
"clap 4.4.7",
"clap 4.4.8",
"dotenvy",
"futures",
"sea-orm",
@ -4899,9 +4875,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"
[[package]]
name = "sentry"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0097a48cd1999d983909f07cb03b15241c5af29e5e679379efac1c06296abecc"
checksum = "6ce4b57f1b521f674df7a1d200be8ff5d74e3712020ee25b553146657b5377d5"
dependencies = [
"httpdate",
"reqwest",
@ -4920,9 +4896,9 @@ dependencies = [
[[package]]
name = "sentry-anyhow"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4fd76cd5c14676228996a31aa214adb049920b103bbc5b5a4114d05323995c5"
checksum = "8868ca6e513f7a80b394b7e0f4b6071afeebb69e62b5e4aafe37b45e431fac8b"
dependencies = [
"anyhow",
"sentry-backtrace",
@ -4931,9 +4907,9 @@ dependencies = [
[[package]]
name = "sentry-backtrace"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a7b80fa1dd6830a348d38a8d3a9761179047757b7dca29aef82db0118b9670"
checksum = "58cc8d4e04a73de8f718dc703943666d03f25d3e9e4d0fb271ca0b8c76dfa00e"
dependencies = [
"backtrace",
"once_cell",
@ -4943,9 +4919,9 @@ dependencies = [
[[package]]
name = "sentry-contexts"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7615dc588930f1fd2e721774f25844ae93add2dbe2d3c2f995ce5049af898147"
checksum = "6436c1bad22cdeb02179ea8ef116ffc217797c028927def303bc593d9320c0d1"
dependencies = [
"hostname",
"libc",
@ -4957,9 +4933,9 @@ dependencies = [
[[package]]
name = "sentry-core"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f51264e4013ed9b16558cce43917b983fa38170de2ca480349ceb57d71d6053"
checksum = "901f761681f97db3db836ef9e094acdd8756c40215326c194201941947164ef1"
dependencies = [
"once_cell",
"rand 0.8.5",
@ -4970,9 +4946,9 @@ dependencies = [
[[package]]
name = "sentry-panic"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "323160213bba549f9737317b152af116af35c0410f4468772ee9b606d3d6e0fa"
checksum = "74fbf1c163f8b6a9d05912e1b272afa27c652e8b47ea60cb9a57ad5e481eea99"
dependencies = [
"sentry-backtrace",
"sentry-core",
@ -4980,9 +4956,9 @@ dependencies = [
[[package]]
name = "sentry-tracing"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38033822128e73f7b6ca74c1631cef8868890c6cb4008a291cf73530f87b4eac"
checksum = "82eabcab0a047040befd44599a1da73d3adb228ff53b5ed9795ae04535577704"
dependencies = [
"sentry-backtrace",
"sentry-core",
@ -4992,9 +4968,9 @@ dependencies = [
[[package]]
name = "sentry-types"
version = "0.31.7"
version = "0.31.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e663b3eb62ddfc023c9cf5432daf5f1a4f6acb1df4d78dd80b740b32dd1a740"
checksum = "da956cca56e0101998c8688bc65ce1a96f00673a0e58e663664023d4c7911e82"
dependencies = [
"debugid",
"hex",
@ -5729,6 +5705,18 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syn_derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.39",
]
[[package]]
name = "sync_wrapper"
version = "0.1.2"
@ -5794,9 +5782,9 @@ dependencies = [
[[package]]
name = "termcolor"
version = "1.3.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64"
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"
dependencies = [
"winapi-util",
]
@ -6245,9 +6233,9 @@ dependencies = [
[[package]]
name = "tracing-log"
version = "0.1.4"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"once_cell",
@ -6256,9 +6244,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
version = "0.3.17"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
dependencies = [
"matchers",
"nu-ansi-term",
@ -6672,7 +6660,7 @@ dependencies = [
"influxdb2",
"influxdb2-structmap",
"ipnet",
"itertools 0.11.0",
"itertools 0.12.0",
"latency",
"listenfd",
"migration",
@ -6912,18 +6900,18 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]]
name = "zerocopy"
version = "0.7.25"
version = "0.7.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557"
checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.25"
version = "0.7.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b"
checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
dependencies = [
"proc-macro2",
"quote",

@ -1,3 +1,32 @@
FROM debian:bullseye-slim as mold
ENV SHELL /bin/bash
SHELL [ "/bin/bash", "-c" ]
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -eux -o pipefail; \
\
apt-get update; \
apt-get install --no-install-recommends --yes \
ca-certificates \
git \
;
RUN { set -eux; \
\
git clone https://github.com/rui314/mold.git; \
mkdir mold/build; \
cd mold/build; \
git checkout v2.3.3; \
../install-build-deps.sh; \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=c++ ..; \
cmake --build . -j $(nproc); \
cmake --build . --target install; \
}
COPY ./docker/cargo-config.toml /root/.cargo/config.toml
FROM debian:bullseye-slim as rust
WORKDIR /app
@ -10,6 +39,7 @@ ENV SHELL /bin/bash
SHELL [ "/bin/bash", "-c" ]
# install rustup dependencies
# install clang for mold
# also install web3-proxy system dependencies. most things are rust-only, but not everything
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
@ -19,6 +49,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
apt-get install --no-install-recommends --yes \
build-essential \
ca-certificates \
clang \
cmake \
curl \
git \
@ -53,6 +84,10 @@ RUN --mount=type=cache,target=/root/.cargo/git \
cp ./rust-toolchain.toml /app/target/rust-toolchain.toml; \
cp ./rust-toolchain.toml /app/target_test/rust-toolchain.toml
# install mold (a faster linker)
COPY --link --from=mold /usr/local/bin/mold /usr/local/bin/mold
COPY --link --from=mold /root/.cargo/config.toml /root/.cargo/config.toml
# cargo binstall makes it fast to install binaries
RUN --mount=type=cache,target=/root/.cargo/git \
--mount=type=cache,target=/root/.cargo/registry \

7
docker/cargo-config.toml Normal file

@ -0,0 +1,7 @@
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/mold"]
[target.aarch64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/mold"]

@ -11,6 +11,6 @@ path = "src/mod.rs"
[dependencies]
ethers = { version = "2.0.10", default-features = false }
sea-orm = "0.12.4"
sea-orm = "0.12.6"
serde = "1.0.192"
ulid = "1.1.0"

@ -13,7 +13,7 @@ tokio = { version = "1.34.0", features = ["full", "tracing"] }
chrono = "0.4.31"
[dependencies.sea-orm-migration]
version = "0.12.4"
version = "0.12.6"
features = [
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.

@ -57,12 +57,12 @@ futures-util = "0.3.29"
glob = "0.3.1"
handlebars = "4.5.0"
hashbrown = { version = "0.14.2", features = ["serde", "nightly"] }
hdrhistogram = "7.5.2"
hdrhistogram = "7.5.3"
hostname = "0.3.1"
http = "0.2.9"
http = "0.2.11"
hyper = { version = "0.14.27", features = ["full", "nightly"] }
ipnet = { version = "2.9.0" }
itertools = "0.11.0"
itertools = "0.12.0"
listenfd = { version = "1.0.1", optional = true }
mimalloc = { version = "0.1.39", optional = true }
moka = { version = "0.12.1", default-features = false, features = ["atomic64", "future", "quanta"] }
@ -75,9 +75,9 @@ pagerduty-rs = { version = "0.1.6", default-features = false, features = ["async
parking_lot = { version = "0.12.1", features = ["arc_lock", "nightly"] }
rdkafka = { version = "0.36.0", default-features = false, features = ["tokio", "tracing"], optional = true }
reqwest = { version = "0.11.22", default-features = false, features = ["json", "rustls"] }
rust_decimal = { version = "1.32.0" }
sentry = { version = "0.31.7", default-features = false, features = ["anyhow", "backtrace", "contexts", "panic", "reqwest", "rustls", "serde_json", "tracing"] }
sentry-tracing = "0.31.7"
rust_decimal = { version = "1.33.0" }
sentry = { version = "0.31.8", default-features = false, features = ["anyhow", "backtrace", "contexts", "panic", "reqwest", "rustls", "serde_json", "tracing"] }
sentry-tracing = "0.31.8"
serde = { version = "1.0.192" }
serde-inline-default = "0.1.1"
serde_json = { version = "1.0.108", default-features = false, features = ["raw_value"] }