Skip to content

Commit

Permalink
Merge pull request #323 from LGFae/trim-dev-dependencies
Browse files Browse the repository at this point in the history
trim dependencies: criterion features and fastrand
  • Loading branch information
LGFae committed May 31, 2024
2 parents e57b9b4 + d1819bc commit 319b7fb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 199 deletions.
183 changes: 8 additions & 175 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ image = { version = "0.25", default-features = false, features = [
]}
fast_image_resize = "4.0"
clap = { version = "4.5", features = ["derive", "wrap_help", "env"] }
rand = "0.8"
fastrand = { version = "2.1", default-features = false, features = [ "std" ] }
utils = { version = "0.9.5-masterV2", path = "utils" }

[dev-dependencies]
Expand Down
2 changes: 0 additions & 2 deletions daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ keyframe = "1.1"
sd-notify = { version = "0.4.1" }

utils = { version = "0.9.5-masterV2", path = "../utils" }
[dev-dependencies]
rand = "0.8"
14 changes: 7 additions & 7 deletions src/imgproc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,22 +482,22 @@ pub fn make_transition(img: &cli::Img) -> ipc::Transition {
}
cli::TransitionType::Any => {
pos = Position::new(
Coord::Percent(rand::random::<f32>()),
Coord::Percent(rand::random::<f32>()),
Coord::Percent(fastrand::f32()),
Coord::Percent(fastrand::f32()),
);
if rand::random::<u8>() % 2 == 0 {
if fastrand::bool() {
ipc::TransitionType::Grow
} else {
ipc::TransitionType::Outer
}
}
cli::TransitionType::Random => {
pos = Position::new(
Coord::Percent(rand::random::<f32>()),
Coord::Percent(rand::random::<f32>()),
Coord::Percent(fastrand::f32()),
Coord::Percent(fastrand::f32()),
);
angle = rand::random();
match rand::random::<u8>() % 4 {
angle = fastrand::f64();
match fastrand::u8(0..4) {
0 => ipc::TransitionType::Simple,
1 => ipc::TransitionType::Wipe,
2 => ipc::TransitionType::Outer,
Expand Down
4 changes: 2 additions & 2 deletions utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ rustix = { version = "0.38", default-features = false, features = [ "std", "net"
pkg-config = "0.3"

[dev-dependencies]
rand = "0.8"
criterion = "0.5"
fastrand = { version = "2.1", default-features = false, features = [ "std" ] }
criterion = { version = "0.5", default-features = false }

[[bench]]
name = "compression"
Expand Down
7 changes: 3 additions & 4 deletions utils/src/compression/comp/sse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ pub(super) unsafe fn pack_bytes(cur: &[u8], goal: &[u8], v: &mut Vec<u8>) {
mod tests {
use super::*;
use crate::compression::unpack_bytes_4channels;
use rand::prelude::random;

#[test]
fn count_equal_test() {
Expand Down Expand Up @@ -186,7 +185,7 @@ mod tests {
for _ in 0..20 {
let mut v = Vec::with_capacity(3000);
for _ in 0..3000 {
v.push(random::<u8>());
v.push(fastrand::u8(..));
}
original.push(v);
}
Expand Down Expand Up @@ -233,13 +232,13 @@ mod tests {
let mut v = Vec::with_capacity(3006);
v.extend([j, 0, 0, 0, 0, j]);
for _ in 0..750 {
v.push(random::<u8>());
v.push(fastrand::u8(..));
}
for i in 0..750 {
v.push((i % 255) as u8);
}
for _ in 0..750 {
v.push(random::<u8>());
v.push(fastrand::u8(..));
}
for i in 0..750 {
v.push((i % 255) as u8);
Expand Down
7 changes: 3 additions & 4 deletions utils/src/compression/decomp/ssse3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub(super) unsafe fn unpack_bytes_4channels(buf: &mut [u8], diff: &[u8]) {
mod tests {
use super::*;
use crate::compression::pack_bytes;
use rand::prelude::random;

fn buf_from(slice: &[u8]) -> Vec<u8> {
let mut v = Vec::new();
Expand Down Expand Up @@ -102,7 +101,7 @@ mod tests {
for _ in 0..20 {
let mut v = Vec::with_capacity(3000);
for _ in 0..3000 {
v.push(random::<u8>());
v.push(fastrand::u8(..));
}
original.push(v);
}
Expand Down Expand Up @@ -148,13 +147,13 @@ mod tests {
for _ in 0..20 {
let mut v = Vec::with_capacity(3000);
for _ in 0..750 {
v.push(random::<u8>());
v.push(fastrand::u8(..));
}
for i in 0..750 {
v.push((i % 255) as u8);
}
for _ in 0..750 {
v.push(random::<u8>());
v.push(fastrand::u8(..));
}
for i in 0..750 {
v.push((i % 255) as u8);
Expand Down
Loading

0 comments on commit 319b7fb

Please sign in to comment.