mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-13 05:20:28 +08:00
perf: separate Clone implementation for Draft struct and remove trait bound from struct definition
Improve around 2% - 16% CPU performance
This commit is contained in:
parent
c57a962109
commit
5103868119
@ -6,8 +6,8 @@ type DraftInner<T> = (SharedDraft<T>, Option<SharedDraft<T>>);
|
||||
|
||||
/// Draft 管理:committed 与 optional draft 都以 Arc<Box<T>> 存储,
|
||||
// (committed_snapshot, optional_draft_snapshot)
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Draft<T: Clone> {
|
||||
#[derive(Debug)]
|
||||
pub struct Draft<T> {
|
||||
inner: Arc<RwLock<DraftInner<T>>>,
|
||||
}
|
||||
|
||||
@ -90,3 +90,11 @@ impl<T: Clone> Draft<T> {
|
||||
Ok(res)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Clone> Clone for Draft<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
inner: Arc::clone(&self.inner),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user