Own shares are never watched back through the server (no encode without remote viewers: sharing idle cpu 10% → 3.7%, vram 129M → 0), tile ticker idles at 250ms without tiles, harness profile drops debug assertions in deps (no Vulkan validation layer, pss 176M → 120M)
Browse files at this commit0edf6ef5eee0eff427752abacebcd958da3b6a5dParent: e462b46- perf
- own shares are never watched back through the server (no encode without remote viewers: sharing idle cpu 10% → 3.7%, vram 129M → 0), tile ticker idles at 250ms without tiles, harness profile drops debug assertions in deps (no Vulkan validation layer, pss 176M → 120M)
3 changed files +22 -6
- Cargo.toml +5 -0
- crates/client/src/gui/camera_view.rs +14 -6
- crates/client/src/gui/share_view.rs +3 -0
Cargo.tomlmodified+5 -0
| @@ -20,6 +20,11 @@ opt-level = 3 | |||
| 20 | [profile.harness] | 20 | [profile.harness] |
| 21 | inherits = "dev" | 21 | inherits = "dev" |
| 22 | opt-level = 3 | 22 | opt-level = 3 |
| 23 | +debug-assertions = false | ||
| 24 | +overflow-checks = false | ||
| 25 | + | ||
| 26 | +[profile.harness.package.client] | ||
| 27 | +debug-assertions = true | ||
| 23 | 28 | ||
| 24 | [profile.release] | 29 | [profile.release] |
| 25 | opt-level = 3 | 30 | opt-level = 3 |
crates/client/src/gui/camera_view.rsmodified+14 -6
| @@ -1,3 +1,5 @@ | |||
| 1 | +use std::time::Duration; | ||
| 2 | + | ||
| 1 | use common::model::Id; | 3 | use common::model::Id; |
| 2 | 4 | ||
| 3 | use common::share::{Fps, Kind, Quality, Resolution}; | 5 | use common::share::{Fps, Kind, Quality, Resolution}; |
| @@ -19,6 +21,8 @@ use super::{ | |||
| 19 | }; | 21 | }; |
| 20 | use crate::share::session::WatchQuality; | 22 | use crate::share::session::WatchQuality; |
| 21 | 23 | ||
| 24 | +const IDLE_TICK: Duration = Duration::from_millis(250); | ||
| 25 | + | ||
| 22 | pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality { | 26 | pub(super) const TILE_QUALITY: WatchQuality = WatchQuality::Fixed(Quality { |
| 23 | resolution: Resolution::P360, | 27 | resolution: Resolution::P360, |
| 24 | fps: Fps::F30, | 28 | fps: Fps::F30, |
| @@ -56,7 +60,7 @@ impl Yumush { | |||
| 56 | .collect() | 60 | .collect() |
| 57 | } | 61 | } |
| 58 | 62 | ||
| 59 | - pub(super) fn tick_tiles(&mut self, cx: &mut Context<Self>) { | 63 | + pub(super) fn tick_tiles(&mut self, cx: &mut Context<Self>) -> bool { |
| 60 | let wanted = self.tile_sources(); | 64 | let wanted = self.tile_sources(); |
| 61 | let viewing = self.viewing(); | 65 | let viewing = self.viewing(); |
| 62 | let quality = tile_quality(self.chat.stage); | 66 | let quality = tile_quality(self.chat.stage); |
| @@ -77,7 +81,7 @@ impl Yumush { | |||
| 77 | }, | 81 | }, |
| 78 | ); | 82 | ); |
| 79 | changed = true; | 83 | changed = true; |
| 80 | - if viewing == Some(source) { | 84 | + if viewing == Some(source) || self.is_me(source.0) { |
| 81 | continue; | 85 | continue; |
| 82 | } | 86 | } |
| 83 | let (user_id, kind) = source; | 87 | let (user_id, kind) = source; |
| @@ -107,7 +111,7 @@ impl Yumush { | |||
| 107 | { | 111 | { |
| 108 | cx.drop_image(frame, None); | 112 | cx.drop_image(frame, None); |
| 109 | } | 113 | } |
| 110 | - if viewing != Some(source) { | 114 | + if viewing != Some(source) && !self.is_me(source.0) { |
| 111 | let network = self.network.clone(); | 115 | let network = self.network.clone(); |
| 112 | let (user_id, kind) = source; | 116 | let (user_id, kind) = source; |
| 113 | cx.spawn(async move |_, _| { | 117 | cx.spawn(async move |_, _| { |
| @@ -139,6 +143,7 @@ impl Yumush { | |||
| 139 | if changed { | 143 | if changed { |
| 140 | cx.notify(); | 144 | cx.notify(); |
| 141 | } | 145 | } |
| 146 | + !self.chat.tiles.is_empty() | ||
| 142 | } | 147 | } |
| 143 | 148 | ||
| 144 | pub(super) fn set_stage(&mut self, stage: Stage, cx: &mut Context<Self>) { | 149 | pub(super) fn set_stage(&mut self, stage: Stage, cx: &mut Context<Self>) { |
| @@ -291,10 +296,13 @@ impl Yumush { | |||
| 291 | 296 | ||
| 292 | pub(super) fn ticker(cx: &mut Context<Yumush>) -> Task<()> { | 297 | pub(super) fn ticker(cx: &mut Context<Yumush>) -> Task<()> { |
| 293 | cx.spawn(async move |this, cx| { | 298 | cx.spawn(async move |this, cx| { |
| 299 | + let mut busy = false; | ||
| 294 | loop { | 300 | loop { |
| 295 | - cx.background_executor().timer(FRAME_TICK).await; | 301 | + let tick = if busy { FRAME_TICK } else { IDLE_TICK }; |
| 296 | - if this.update(cx, |yumush, cx| yumush.tick_tiles(cx)).is_err() { | 302 | + cx.background_executor().timer(tick).await; |
| 297 | - break; | 303 | + match this.update(cx, |yumush, cx| yumush.tick_tiles(cx)) { |
| 304 | + Ok(next) => busy = next, | ||
| 305 | + Err(_) => break, | ||
| 298 | } | 306 | } |
| 299 | } | 307 | } |
| 300 | }) | 308 | }) |
crates/client/src/gui/share_view.rsmodified+3 -0
| @@ -258,6 +258,9 @@ impl Yumush { | |||
| 258 | window: &mut Window, | 258 | window: &mut Window, |
| 259 | cx: &mut Context<Self>, | 259 | cx: &mut Context<Self>, |
| 260 | ) { | 260 | ) { |
| 261 | + if self.is_me(user_id) { | ||
| 262 | + return; | ||
| 263 | + } | ||
| 261 | let watching = self.is_watching(user_id, kind); | 264 | let watching = self.is_watching(user_id, kind); |
| 262 | self.close_viewer(cx); | 265 | self.close_viewer(cx); |
| 263 | if watching { | 266 | if watching { |