Lots of claude-driven performance work.
This commit is contained in:
@@ -11,6 +11,7 @@ use std::collections::HashMap;
|
||||
use std::error::Error;
|
||||
use std::future::Future;
|
||||
use std::iter;
|
||||
use std::time::Instant;
|
||||
use std::marker::PhantomData;
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -18,11 +19,11 @@ use ruin_reactivity::effect;
|
||||
use ruin_runtime::queue_future;
|
||||
use ruin_ui::{
|
||||
Border, Color, CursorIcon, DisplayItem, Edges, Element, ElementId, HitTarget, InteractionTree,
|
||||
KeyboardEvent, KeyboardEventKind, KeyboardKey, LayoutSnapshot, PlatformEvent, PointerButton,
|
||||
PointerEvent, PointerEventKind, PointerRouter, Quad, RoutedPointerEvent,
|
||||
KeyboardEvent, KeyboardEventKind, KeyboardKey, LayoutCache, LayoutSnapshot, PlatformEvent,
|
||||
PointerButton, PointerEvent, PointerEventKind, PointerRouter, Quad, RoutedPointerEvent,
|
||||
RoutedPointerEventKind, ScrollbarStyle, TextFontFamily, TextSpan, TextSpanWeight, TextStyle,
|
||||
TextSystem, TextWrap, UiSize, WindowController, WindowSpec, WindowUpdate,
|
||||
layout_snapshot_with_text_system,
|
||||
layout_snapshot_with_cache,
|
||||
};
|
||||
use ruin_ui_platform_wayland::start_wayland_ui;
|
||||
|
||||
@@ -158,6 +159,7 @@ impl<M: Mountable> MountedApp<M> {
|
||||
let viewport = ruin_reactivity::cell(initial_viewport);
|
||||
let scene_version = StdCell::new(0_u64);
|
||||
let text_system = Rc::new(RefCell::new(TextSystem::new()));
|
||||
let layout_cache = Rc::new(RefCell::new(LayoutCache::new()));
|
||||
let interaction_tree = Rc::new(RefCell::new(None::<InteractionTree>));
|
||||
let bindings = Rc::new(RefCell::new(EventBindings::default()));
|
||||
let shortcuts = Rc::new(RefCell::new(Vec::<ShortcutBinding>::new()));
|
||||
@@ -169,6 +171,7 @@ impl<M: Mountable> MountedApp<M> {
|
||||
let window = window.clone();
|
||||
let viewport = viewport.clone();
|
||||
let text_system = Rc::clone(&text_system);
|
||||
let layout_cache = Rc::clone(&layout_cache);
|
||||
let interaction_tree = Rc::clone(&interaction_tree);
|
||||
let bindings = Rc::clone(&bindings);
|
||||
let shortcuts = Rc::clone(&shortcuts);
|
||||
@@ -182,6 +185,8 @@ impl<M: Mountable> MountedApp<M> {
|
||||
scene_version.set(version);
|
||||
let _ = text_selection.version.get();
|
||||
|
||||
let t_effect = Instant::now();
|
||||
|
||||
let render_output = render_with_context(Rc::clone(&render_state), || root.render());
|
||||
|
||||
if render_output.side_effects.window_title != *current_title.borrow() {
|
||||
@@ -193,14 +198,30 @@ impl<M: Mountable> MountedApp<M> {
|
||||
*current_title.borrow_mut() = render_output.side_effects.window_title.clone();
|
||||
}
|
||||
|
||||
let render_us = t_effect.elapsed().as_micros();
|
||||
let t_layout = Instant::now();
|
||||
let LayoutSnapshot {
|
||||
mut scene,
|
||||
interaction_tree: next_interaction_tree,
|
||||
} = layout_snapshot_with_text_system(
|
||||
} = layout_snapshot_with_cache(
|
||||
version,
|
||||
viewport,
|
||||
render_output.view.element(),
|
||||
&mut text_system.borrow_mut(),
|
||||
&mut layout_cache.borrow_mut(),
|
||||
);
|
||||
let layout_us = t_layout.elapsed().as_micros();
|
||||
let effect_us = t_effect.elapsed().as_micros();
|
||||
|
||||
tracing::debug!(
|
||||
target: "ruin_app::resize",
|
||||
version,
|
||||
width = viewport.width,
|
||||
height = viewport.height,
|
||||
render_us,
|
||||
layout_us,
|
||||
effect_us,
|
||||
"scene effect complete, sending ReplaceScene"
|
||||
);
|
||||
|
||||
apply_text_selection_overlay(&mut scene, *text_selection.selection.borrow());
|
||||
@@ -225,6 +246,12 @@ impl<M: Mountable> MountedApp<M> {
|
||||
window_id,
|
||||
configuration,
|
||||
} if window_id == window.id() => {
|
||||
tracing::debug!(
|
||||
target: "ruin_app::resize",
|
||||
width = configuration.actual_inner_size.width,
|
||||
height = configuration.actual_inner_size.height,
|
||||
"app received Configured, queuing layout effect"
|
||||
);
|
||||
let _ = viewport.set(configuration.actual_inner_size);
|
||||
}
|
||||
PlatformEvent::Pointer { window_id, event } if window_id == window.id() => {
|
||||
|
||||
Reference in New Issue
Block a user