Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

TL13a: raea-page-host restyles finely by default. Each attribute set or cleared restyles what Stylo's snapshot invalidation finds and each ancestor itself, not the element's parent's whole subtree; RAEA_FINE_RESTYLE=0 brings back Blitz's own way, and other binaries keep it off unless set. Proven before it was made the default: ui-parity full with it on is 269/271, the same two cases failing as with it off (p15-media canvas-text and img-downscale); the app's timeline suite in a headless raea window with it on passes 53 of 54 (TL10d skips itself there); the 400-clip drag in that window ran at 48-50 fps against 38-41 without, the window's still rate 52-55. The page host sets it in main before any thread starts, as --root's RAEA_PAGE_ROOT is. docs/timeline.feature TL13a has the numbers

shinyobjectz9cffd0bf0a76
diff --git a/docs/timeline.feature b/docs/timeline.feature
index 9bd7a074..2b35fdcf 100644
--- a/docs/timeline.feature
+++ b/docs/timeline.feature
@@ -314,17 +314,22 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
drawn smaller than they ship and laid out as they ship (raea's <Composition edit={{ scale }}>, the
long side at 960 px; docs/lightspeed.feature PF4): a ray-traced 1080p shot's draft 2.75 s at full
size, 1.7 s scaled
- not built TL13a's drag at the window's rate with 400 clips (measured below: Chrome keeps it, raea's window
- draws 35 frames a second, bound by the page host's frame after a step: Stylo's restyle, which Blitz
- widens to the changed element's parent's whole subtree, paint, and every element's rect taken each
- frame. RAEA_FINE_RESTYLE=1 (a trial in vendor/blitz-dom mutator.rs, off by default) measured 11-14 in
- a headless window, three rounds alternating: the drag 37, 47 and 49 fps (median frame 25.0, 19.2,
- 18.9 ms) against 31, 34 and 38 off (34.6, 30.4, 27.9 ms), the window's still rate 51-57; not yet
- the window's rate, and not the default until ui-parity passes with it on (its build waits on disk:
- 1 GB free). In one drag profiled with it on (the run timed out under the profiler, so a weak
- read), the page host's busiest frames were the rect walk (get_client_bounding_rect,
- transformed_rect); drawing only the clips in view would
- draw none fewer, since at its opening fit all 12 tracks and all 400 clips are on screen at once).
+ not built TL13a's drag at the window's rate with 400 clips, though close (measured below: Chrome keeps it;
+ raea's window drew 35 frames a second, bound by the page host's frame after a step: Stylo's restyle,
+ which Blitz widened to the changed element's parent's whole subtree, paint, and every element's rect
+ taken each frame). raea-page-host now restyles finely by default (vendor/blitz-dom mutator.rs: what
+ the snapshot's invalidation finds, the changed attribute named in the snapshot even when it was
+ added, and each ancestor itself for `:has()`; RAEA_FINE_RESTYLE=0 for Blitz's own way), and a rect
+ with no transform above it is answered without matrix math. ui-parity with it: 269/271, the same
+ two cases failing as without (p15-media canvas-text, img-downscale); before the snapshot and :has()
+ fixes it was 266. The app's timeline suite in a headless window with it: 53 of 54 pass, TL10d
+ skipping itself there. Measured 11-14 in a headless window, three rounds alternating: the drag 38-41
+ fps without, 48-50 with, against the window's still rate of 52-55, so about 90% of it; a pick
+ 42-62 ms and a split 46-63 ms. A sync of the twins that keeps their boxes on each pointer move
+ (RAEA_TWIN_SYNC_LIGHT=1, a trial, off) gained nothing. Under another session's load the drag held
+ the same share of the still rate with the :has() fix as without (0.66-0.72 each, four rounds).
+ Drawing only the clips in view would draw none fewer: at its opening fit all 12 tracks and all 400
+ clips are on screen at once.
TL13a's stage clause is met (an edit on the scene's stage by 88 ms, median, TL13b). The
skills guide's note on an item's `timeline` field waits for PR #19 to merge
diff --git a/engine/page/host/src/main.rs b/engine/page/host/src/main.rs
index 303963ba..4aee8951 100644
--- a/engine/page/host/src/main.rs
+++ b/engine/page/host/src/main.rs
@@ -6,7 +6,9 @@
//! it, bevy_ui's kinds. --root: where the page's own-origin fetches are read from (RAEA_PAGE_ROOT). --size: the
//! window, default 1440x900. RAEA_PAGE_BRP_PORT (default: a free one), RAEA_PAGE_MCP_PORT (default 7477; 0: none),
//! RAEA_PAGE_PICK=0: the page's pointers and keys dispatched by the host (page::input) instead of through raea-page's
-//! picking route, the default. The page's `<img data-raea-stage>` plays a composition live (raea-page-stage).
+//! picking route, the default. RAEA_FINE_RESTYLE=0: an attribute change restyles its element's parent's whole subtree
+//! (Blitz's own way; the host's default is the fine restyle, docs/timeline.feature TL13a). The page's
+//! `<img data-raea-stage>` plays a composition live (raea-page-stage).
//! --chrome inset: the page under a transparent title bar, its title area moving the window (raea-page-window).
//! --window (built with the `window` feature): on screen, a window of its own that closes the app (raea's desktop app;
//! RAEA_PAGE_HOST sends the page's /host/* to the feed's host: raea-page-net).
@@ -63,6 +65,14 @@ fn main() {
eprintln!("raea-page-host: {e}");
std::process::exit(2);
});
+ // a page's attribute set or cleared restyles what Stylo's invalidation finds, and each ancestor itself, not the
+ // element's parent's whole subtree (vendor/blitz-dom mutator.rs): ui-parity's 271 cases come out the same case by
+ // case, and a 400-clip timeline drag in raea feed's window went from 38-41 to 48-50 frames a second
+ // (docs/timeline.feature TL13a). RAEA_FINE_RESTYLE=0 restyles the parent's whole subtree, as before. Set here,
+ // before any thread starts, as --root's RAEA_PAGE_ROOT is.
+ if std::env::var_os("RAEA_FINE_RESTYLE").is_none() {
+ unsafe { std::env::set_var("RAEA_FINE_RESTYLE", "1") }
+ }
// headless (the benches, raea app check): the system's clipboard, files, dialogs and browser stay untouched (T2d)
if !a.window {
raea_io_os::set_headless();
diff --git a/vendor/blitz-dom/src/mutator.rs b/vendor/blitz-dom/src/mutator.rs
index 474fe32f..979ebe75 100644
--- a/vendor/blitz-dom/src/mutator.rs
+++ b/vendor/blitz-dom/src/mutator.rs
@@ -43,10 +43,11 @@ enum SpecialOp {
UnloadCustomWidget(NodeId),
}
-/// raea (RAEA_FINE_RESTYLE=1, a trial, off by default): an attribute set or cleared restyles only what its snapshot's
-/// invalidation finds (the selectors that read it, siblings' and ancestors' included) and, for `style`, the element's
-/// own declarations (RESTYLE_STYLE_ATTRIBUTE, below), as Servo does, instead of the element's and its parent's whole
-/// subtrees. A clip dragged along a timeline track restyled every clip on the track each step (raea feed's TL13a).
+/// raea (RAEA_FINE_RESTYLE=1; off unless set, and raea-page-host sets it unless it's set already): an attribute set or
+/// cleared restyles only what its snapshot's invalidation finds (the selectors that read it, siblings' and ancestors'
+/// included), each ancestor itself (for `:has()`), and, for `style`, the element's own declarations
+/// (RESTYLE_STYLE_ATTRIBUTE, below), as Servo does, instead of the element's and its parent's whole subtrees. A clip
+/// dragged along a timeline track restyled every clip on the track each step (raea feed's TL13a).
fn fine_restyle() -> bool {
static ON: std::sync::LazyLock<bool> = std::sync::LazyLock::new(|| std::env::var_os("RAEA_FINE_RESTYLE").is_some_and(|v| v == "1"));
*ON