Faster busy-client frames: read only the buffer's bytes, cache the wallpaper, cheaper strokes
CI / test (push) Failing after 18s
CI / test (push) Failing after 18s
Profiling a full-screen terminal at 1080p (about 2 fps): - snapshot_shm_buffer asked the host to copy the pool from byte 0 to the end of the buffer; foot puts its buffers deep in a ~135 MB pool, so every commit moved ~135 MB (~185 ms). New sys.mmap-read-at(fd, offset, len) copies just the buffer: step 200 ms -> 5 ms per frame. - The wallpaper (gradient + discs) is rendered once and copied back each frame while unchanged; it is split from the desktop card, which changes every second. - stroke_rounded_rect walked every pixel of the window to draw a 1px outline; it now only draws the border strips (exact per-pixel path kept for the corner bands). - Window shadows only blend the strips that stick out from under the window. Rasteriser: ~256 ms -> ~93 ms per full-screen frame. Tests compare strokes and fills with the old per-pixel code, and check the wallpaper cache. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70ad87f2d2
commit
66bf293085
21 files changed
+302
-136
No files matched your search
@@ -196,6 +196,8 @@ pub(all) struct DesktopShell {
|
||||
mut tokens : @theme.Tokens
|
||||
mut screen_w : Int
|
||||
/// Desktop card position (once moved) and drag state.
|
||||
/// How many of the background ops are the static wallpaper (the rest is the desktop card).
|
||||
mut wallpaper_len : Int
|
||||
mut desk_set : Bool
|
||||
mut desk_x : Int
|
||||
mut desk_y : Int
|
||||
@@ -273,6 +275,7 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
|
||||
win_geoms: {},
|
||||
tokens: conv_theme(@scene.ThemeTokens::moon_night()),
|
||||
screen_w: 0,
|
||||
wallpaper_len: 0,
|
||||
desk_set: false,
|
||||
desk_x: 0,
|
||||
desk_y: 0,
|
||||
@@ -763,6 +766,7 @@ pub fn DesktopShell::render(
|
||||
}
|
||||
let bg : Array[@scene.DrawOp] = []
|
||||
translate(@libshell.render_background(@ui.size(w, h), tokens), 0, 0, bg)
|
||||
self.wallpaper_len = bg.length()
|
||||
let (dx, dy) = self.desk_pos()
|
||||
render_desktop_widget(dx, dy, tokens, now(), bg)
|
||||
|
||||
|
||||
Reference in new issue
Block a user