mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-04-12 23:42:27 -04:00
build releases with mimalloc
This commit is contained in:
parent
0ccc6d0769
commit
39b6f6c49c
24
.github/workflows/release.yml
vendored
24
.github/workflows/release.yml
vendored
@ -52,16 +52,16 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# Note: keep these arches in sync with `Upload Docker Manifest` list.
|
# Note: keep these arches in sync with `Upload Docker Manifest` list.
|
||||||
- arch: x86_64 # as in `uname -m` on Linux.
|
- arch: x86_64 # as in `uname -m` on Linux.
|
||||||
rust_target: x86_64-unknown-linux-musl # as in <https://doc.rust-lang.org/rustc/platform-support.html>
|
rust_target: x86_64-unknown-linux-musl # as in <https://doc.rust-lang.org/rustc/platform-support.html>
|
||||||
docker_platform: linux/amd64 # as in <https://docs.docker.com/build/building/multi-platform/>
|
docker_platform: linux/amd64 # as in <https://docs.docker.com/build/building/multi-platform/>
|
||||||
- arch: aarch64
|
- arch: aarch64
|
||||||
rust_target: aarch64-unknown-linux-musl
|
rust_target: aarch64-unknown-linux-musl
|
||||||
docker_platform: linux/arm64
|
docker_platform: linux/arm64
|
||||||
- arch: armv7l
|
- arch: armv7l
|
||||||
rust_target: armv7-unknown-linux-musleabihf
|
rust_target: armv7-unknown-linux-musleabihf
|
||||||
docker_platform: linux/arm/v7
|
docker_platform: linux/arm/v7
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -90,7 +90,7 @@ jobs:
|
|||||||
working-directory: server
|
working-directory: server
|
||||||
target: ${{ matrix.rust_target }}
|
target: ${{ matrix.rust_target }}
|
||||||
command: build
|
command: build
|
||||||
args: --release --features bundled
|
args: --release --features bundled,mimalloc
|
||||||
- name: Upload Docker Artifact
|
- name: Upload Docker Artifact
|
||||||
run: |
|
run: |
|
||||||
tag="${DOCKER_TAG}-${{ matrix.arch }}"
|
tag="${DOCKER_TAG}-${{ matrix.arch }}"
|
||||||
@ -115,7 +115,7 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [ base, cross ]
|
needs: [base, cross]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
@ -8,6 +8,11 @@ upgrades, e.g. `v0.6.x` -> `v0.7.x`. The config file format and
|
|||||||
[API](ref/api.md) currently have no stability guarantees, so they may change
|
[API](ref/api.md) currently have no stability guarantees, so they may change
|
||||||
even on minor releases, e.g. `v0.7.5` -> `v0.7.6`.
|
even on minor releases, e.g. `v0.7.5` -> `v0.7.6`.
|
||||||
|
|
||||||
|
## unreleased
|
||||||
|
|
||||||
|
* Release with `mimalloc` allocator, which is significantly faster than the memory
|
||||||
|
allocator built into `musl`.
|
||||||
|
|
||||||
## v0.7.20 (2025-01-31)
|
## v0.7.20 (2025-01-31)
|
||||||
|
|
||||||
* H.265 fixes.
|
* H.265 fixes.
|
||||||
|
18
server/Cargo.lock
generated
18
server/Cargo.lock
generated
@ -284,6 +284,12 @@ dependencies = [
|
|||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cty"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cursive"
|
name = "cursive"
|
||||||
version = "0.21.1"
|
version = "0.21.1"
|
||||||
@ -1072,6 +1078,17 @@ version = "0.2.169"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libmimalloc-sys"
|
||||||
|
version = "0.1.41"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6b20daca3a4ac14dbdc753c5e90fc7b490a48a9131daed3c9a9ced7b2defd37b"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"cty",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libredox"
|
name = "libredox"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
@ -1215,6 +1232,7 @@ dependencies = [
|
|||||||
"futures",
|
"futures",
|
||||||
"jiff",
|
"jiff",
|
||||||
"libc",
|
"libc",
|
||||||
|
"libmimalloc-sys",
|
||||||
"nix",
|
"nix",
|
||||||
"nom",
|
"nom",
|
||||||
"rusqlite",
|
"rusqlite",
|
||||||
|
@ -18,6 +18,7 @@ nightly = ["db/nightly"]
|
|||||||
bundled = ["rusqlite/bundled", "bundled-ui"]
|
bundled = ["rusqlite/bundled", "bundled-ui"]
|
||||||
|
|
||||||
bundled-ui = []
|
bundled-ui = []
|
||||||
|
mimalloc = ["base/mimalloc"]
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["base", "db"]
|
members = ["base", "db"]
|
||||||
@ -42,10 +43,16 @@ uuid = { version = "1.1.2", features = ["serde", "std", "v7", "fast-rng"] }
|
|||||||
base = { package = "moonfire-base", path = "base" }
|
base = { package = "moonfire-base", path = "base" }
|
||||||
base64 = { workspace = true }
|
base64 = { workspace = true }
|
||||||
blake3 = "1.0.0"
|
blake3 = "1.0.0"
|
||||||
bpaf = { version = "0.9.15", features = ["autocomplete", "bright-color", "derive"]}
|
bpaf = { version = "0.9.15", features = [
|
||||||
|
"autocomplete",
|
||||||
|
"bright-color",
|
||||||
|
"derive",
|
||||||
|
] }
|
||||||
bytes = "1"
|
bytes = "1"
|
||||||
byteorder = "1.0"
|
byteorder = "1.0"
|
||||||
cursive = { version = "0.21.1", default-features = false, features = ["termion-backend"] }
|
cursive = { version = "0.21.1", default-features = false, features = [
|
||||||
|
"termion-backend",
|
||||||
|
] }
|
||||||
data-encoding = "2.7.0"
|
data-encoding = "2.7.0"
|
||||||
db = { package = "moonfire-db", path = "db" }
|
db = { package = "moonfire-db", path = "db" }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
@ -70,7 +77,13 @@ rusqlite = { workspace = true }
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
smallvec = { version = "1.7", features = ["union"] }
|
smallvec = { version = "1.7", features = ["union"] }
|
||||||
tokio = { version = "1.24", features = ["macros", "rt-multi-thread", "signal", "sync", "time"] }
|
tokio = { version = "1.24", features = [
|
||||||
|
"macros",
|
||||||
|
"rt-multi-thread",
|
||||||
|
"signal",
|
||||||
|
"sync",
|
||||||
|
"time",
|
||||||
|
] }
|
||||||
tokio-tungstenite = "0.26.1"
|
tokio-tungstenite = "0.26.1"
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
tracing = { workspace = true, features = ["log"] }
|
tracing = { workspace = true, features = ["log"] }
|
||||||
@ -96,7 +109,9 @@ walkdir = "2.3.3"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mp4 = { git = "https://github.com/scottlamb/mp4-rust", branch = "moonfire" }
|
mp4 = { git = "https://github.com/scottlamb/mp4-rust", branch = "moonfire" }
|
||||||
num-rational = { version = "0.4.0", default-features = false, features = ["std"] }
|
num-rational = { version = "0.4.0", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
] }
|
||||||
reqwest = { version = "0.12.0", default-features = false, features = ["json"] }
|
reqwest = { version = "0.12.0", default-features = false, features = ["json"] }
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
tracing-test = "0.2.4"
|
tracing-test = "0.2.4"
|
||||||
|
@ -9,6 +9,7 @@ publish = false
|
|||||||
rust-version = "1.82"
|
rust-version = "1.82"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
mimalloc = ["dep:libmimalloc-sys"]
|
||||||
nightly = []
|
nightly = []
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
@ -16,10 +17,14 @@ path = "lib.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ahash = "0.8"
|
ahash = "0.8"
|
||||||
coded = { git = "https://github.com/scottlamb/coded", rev = "2c97994974a73243d5dd12134831814f42cdb0e8"}
|
coded = { git = "https://github.com/scottlamb/coded", rev = "2c97994974a73243d5dd12134831814f42cdb0e8" }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
jiff = { workspace = true }
|
jiff = { workspace = true }
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
libmimalloc-sys = { version = "0.1.41", features = [
|
||||||
|
"override",
|
||||||
|
"extended",
|
||||||
|
], optional = true }
|
||||||
nix = { workspace = true, features = ["time"] }
|
nix = { workspace = true, features = ["time"] }
|
||||||
nom = "7.0.0"
|
nom = "7.0.0"
|
||||||
rusqlite = { workspace = true }
|
rusqlite = { workspace = true }
|
||||||
|
@ -75,3 +75,16 @@ impl std::ops::Deref for Condvar {
|
|||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ensure_malloc_used() {
|
||||||
|
#[cfg(feature = "mimalloc")]
|
||||||
|
{
|
||||||
|
// This is a load-bearing debug line.
|
||||||
|
// Building `libmimalloc-sys` with the `override` feature will override `malloc` and
|
||||||
|
// `free` as used through the Rust global allocator, SQLite, and `libc`. But...`cargo`
|
||||||
|
// doesn't seem to build `libmimalloc-sys` at all if it's not referenced from Rust code.
|
||||||
|
tracing::debug!("mimalloc version {}", unsafe {
|
||||||
|
libmimalloc_sys::mi_version()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -27,7 +27,9 @@ itertools = { workspace = true }
|
|||||||
jiff = { workspace = true }
|
jiff = { workspace = true }
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
nix = { workspace = true, features = ["dir", "feature", "fs", "mman"] }
|
nix = { workspace = true, features = ["dir", "feature", "fs", "mman"] }
|
||||||
num-rational = { version = "0.4.0", default-features = false, features = ["std"] }
|
num-rational = { version = "0.4.0", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
] }
|
||||||
pretty-hex = { workspace = true }
|
pretty-hex = { workspace = true }
|
||||||
protobuf = "3.0"
|
protobuf = "3.0"
|
||||||
ring = { workspace = true }
|
ring = { workspace = true }
|
||||||
|
@ -656,6 +656,7 @@ mod bench {
|
|||||||
/// Benchmarks the decoder, which is performance-critical for .mp4 serving.
|
/// Benchmarks the decoder, which is performance-critical for .mp4 serving.
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_decoder(b: &mut test::Bencher) {
|
fn bench_decoder(b: &mut test::Bencher) {
|
||||||
|
crate::testutil::init();
|
||||||
let data = include_bytes!("testdata/video_sample_index.bin");
|
let data = include_bytes!("testdata/video_sample_index.bin");
|
||||||
b.bytes = data.len() as u64;
|
b.bytes = data.len() as u64;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
|
@ -37,6 +37,7 @@ pub const TEST_VIDEO_SAMPLE_ENTRY_DATA: &[u8] =
|
|||||||
/// * use a fast but insecure password hashing format.
|
/// * use a fast but insecure password hashing format.
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
|
base::ensure_malloc_used();
|
||||||
base::tracing_setup::install_for_tests();
|
base::tracing_setup::install_for_tests();
|
||||||
base::time::testutil::init_zone();
|
base::time::testutil::init_zone();
|
||||||
crate::auth::set_test_config();
|
crate::auth::set_test_config();
|
||||||
|
@ -77,6 +77,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
base::tracing_setup::install();
|
base::tracing_setup::install();
|
||||||
base::time::init_zone(jiff::tz::TimeZone::system);
|
base::time::init_zone(jiff::tz::TimeZone::system);
|
||||||
|
base::ensure_malloc_used();
|
||||||
|
|
||||||
// Get the program name from the OS (e.g. if invoked as `target/debug/nvr`: `nvr`),
|
// Get the program name from the OS (e.g. if invoked as `target/debug/nvr`: `nvr`),
|
||||||
// falling back to the crate name if conversion to a path/UTF-8 string fails.
|
// falling back to the crate name if conversion to a path/UTF-8 string fails.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user