perf: replace rand with fastrand
This commit is contained in:
parent
98d6d33c87
commit
d2e080427f
5 changed files with 7 additions and 12 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -1133,6 +1133,7 @@ dependencies = [
|
||||||
"cosmic-app-list-config",
|
"cosmic-app-list-config",
|
||||||
"cosmic-client-toolkit",
|
"cosmic-client-toolkit",
|
||||||
"cosmic-protocols",
|
"cosmic-protocols",
|
||||||
|
"fastrand 2.3.0",
|
||||||
"futures",
|
"futures",
|
||||||
"i18n-embed",
|
"i18n-embed",
|
||||||
"i18n-embed-fl",
|
"i18n-embed-fl",
|
||||||
|
|
@ -1140,7 +1141,6 @@ dependencies = [
|
||||||
"itertools 0.14.0",
|
"itertools 0.14.0",
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
"memmap2 0.9.8",
|
"memmap2 0.9.8",
|
||||||
"rand 0.9.2",
|
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.2",
|
||||||
"switcheroo-control",
|
"switcheroo-control",
|
||||||
|
|
@ -1229,11 +1229,11 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bluer",
|
"bluer",
|
||||||
"cosmic-time",
|
"cosmic-time",
|
||||||
|
"fastrand 2.3.0",
|
||||||
"futures",
|
"futures",
|
||||||
"i18n-embed",
|
"i18n-embed",
|
||||||
"i18n-embed-fl",
|
"i18n-embed-fl",
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
"rand 0.9.2",
|
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ image = { version = "0.25.8", default-features = false }
|
||||||
itertools = "0.14.0"
|
itertools = "0.14.0"
|
||||||
libcosmic.workspace = true
|
libcosmic.workspace = true
|
||||||
memmap2 = "0.9.8"
|
memmap2 = "0.9.8"
|
||||||
rand = "0.9.2"
|
fastrand = "2.3.0"
|
||||||
rust-embed.workspace = true
|
rust-embed.workspace = true
|
||||||
rustix.workspace = true
|
rustix.workspace = true
|
||||||
switcheroo-control = { git = "https://github.com/pop-os/dbus-settings-bindings" }
|
switcheroo-control = { git = "https://github.com/pop-os/dbus-settings-bindings" }
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::Sta
|
||||||
use futures::future::pending;
|
use futures::future::pending;
|
||||||
use iced::{Alignment, Background, Length};
|
use iced::{Alignment, Background, Length};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use rand::{Rng, rng};
|
|
||||||
use std::{borrow::Cow, collections::HashMap, path::PathBuf, rc::Rc, str::FromStr, time::Duration};
|
use std::{borrow::Cow, collections::HashMap, path::PathBuf, rc::Rc, str::FromStr, time::Duration};
|
||||||
use switcheroo_control::Gpu;
|
use switcheroo_control::Gpu;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
@ -1084,8 +1083,7 @@ impl cosmic::Application for CosmicAppList {
|
||||||
}
|
}
|
||||||
self.active_list.clear();
|
self.active_list.clear();
|
||||||
let subscription_ctr = self.subscription_ctr;
|
let subscription_ctr = self.subscription_ctr;
|
||||||
let mut rng = rng();
|
let rand_d = fastrand::u64(0..100);
|
||||||
let rand_d = rng.random_range(0..100);
|
|
||||||
return iced::Task::perform(
|
return iced::Task::perform(
|
||||||
async move {
|
async move {
|
||||||
if let Some(millis) = 2u64
|
if let Some(millis) = 2u64
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ futures.workspace = true
|
||||||
i18n-embed-fl.workspace = true
|
i18n-embed-fl.workspace = true
|
||||||
i18n-embed.workspace = true
|
i18n-embed.workspace = true
|
||||||
libcosmic.workspace = true
|
libcosmic.workspace = true
|
||||||
rand = "0.9"
|
fastrand = "2.3.0"
|
||||||
rust-embed.workspace = true
|
rust-embed.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
tracing-log.workspace = true
|
tracing-log.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ use cosmic::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use futures::{FutureExt, stream::FuturesUnordered};
|
use futures::{FutureExt, stream::FuturesUnordered};
|
||||||
use rand::Rng;
|
|
||||||
use tokio::{
|
use tokio::{
|
||||||
spawn,
|
spawn,
|
||||||
sync::{
|
sync::{
|
||||||
|
|
@ -397,8 +396,7 @@ impl BluerSessionState {
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
.await;
|
.await;
|
||||||
let mut rng = rand::rng();
|
let pin_code = fastrand::u32(0..999999);
|
||||||
let pin_code = rng.random_range(0..999999);
|
|
||||||
Ok(format!("{:06}", pin_code))
|
Ok(format!("{:06}", pin_code))
|
||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
|
|
@ -437,8 +435,7 @@ impl BluerSessionState {
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
.await;
|
.await;
|
||||||
let mut rng = rand::rng();
|
let pin_code = fastrand::u32(0..999999);
|
||||||
let pin_code = rng.random_range(0..999999);
|
|
||||||
Ok(pin_code)
|
Ok(pin_code)
|
||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue