ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
763ea9438c |
routing: a live dot pulses by transform and opacity, on the compositor
Routing with requests in flight kept the renderer busy (unscientific9: "高并发路由页面" is slow). Every live dot (the answering account, the live dot, a waiting try, probe, preview target and step) pulsed by a box-shadow keyframe, which Chrome and WebKit run on the main thread: the page was restyled and repainted every frame for as long as anything was under way. Each pulse is now a ::after disk that grows and fades by transform and opacity alone, which the compositor runs without a paint. A muted dot's disk lies behind it (its parent isolates it, the disk at z-index -1), so its colour isn't tinted; a filled dot's disk is its own colour. Sizes match the old shadow (6px each side). Reduced motion and a quiet account still show no pulse. Measured on mote (headless Chromium 1280x820, app mode, sandbox HOME with a 300k-row ledger, a fake upstream, Routing held 30 s, Chrome trace): - 6 in flight: Paint 5714 / 5598 ms -> 3055 / 2804 ms; main-thread RunTask 7448 / 7148 -> 6851 / 6320 ms - 64 in flight: Paint 4408 / 4217 -> 1746 / 1759 ms; RunTask 8056 / 7921 -> 7405 / 7434 ms Most of what is left is the wires' rtflow (stroke-dashoffset, also main thread): with it off as well RunTask is 3415 ms at 6 in flight, and with every animation off 2560 ms. That one changes how the wires look, so it is filed separately, not changed here. Test: routing-pulse-composited.test.cjs, with the real stylesheets in Chromium and WebKit, light and dark: every endless animation of each live dot animates only transform and opacity, each live dot pulses, a muted dot's centre keeps its colour, and no dot moves. reduce-motion, routing-idle-frame and routing-live-bytes read the pulse from ::after now. Run via mote-run: routing-pulse-composited, fonts, reduce-motion, routing-idle-frame, routing-live-bytes, routing-wait-dot and status-dot-shape, 101 of 101 ok. Broken by hand: with the old routing.css the new test fails in both engines. Not run before the push: the wider run of the 359 GUI files that load Routing or the font code; its reds, if any, get issues. Not tried: a real Mac's window (WebKit in the app) on a display; the numbers are headless Chromium. Reported-by: unscientific9 (on Discord) |
||
|
|
0f1b40bbc4 |
gateway: a reply in flight shows on Routing how much has arrived and roughly its tokens (#4951, Canda15)
A long or reasoning reply looked stuck on the Routing page. A request still out now shows, on its row and beside the account answering it, the bytes the agent has had, "≈ n tokens" once a rate is learned, and how long ago content last came; after 15s with no content the account's dot stops pulsing. Nothing stays once the request is done. Ported from Canda15's 7f7bdb189 (github.com/Canda15/magpie), the idea and the per-protocol content extractors kept, the hot path and storage reworked: - every write to the agent passes captureResponseWriter.Write, which calls liveRow.observe; the row hangs on the request's inflight (an atomic pointer), not a context value made per request - rates are in memory only (256 pairs); the fork wrote a JSON file under the estimate lock on every finished request - a whole JSON reply is counted in bytes only: the fork held and decoded up to 8 MiB of it at the end; a stream is cut into lines in place, only a line cut by a write's end is copied, a line over 1 MiB passed over, and each event decoded once (the fork ran json.Valid then Unmarshal) - the reply's kind comes from its first byte, not a header read on every write; the keepalive check allocates nothing (the fork split each write) - everything a row counts is under its own lock, and inflight.tr is read under f.mu; the estimate is in float64 (the int64 product overflowed) - the route's Seq is bumped on every write and traceGather batches the wake-ups; the fork's global throttle could drop the last update before a pause - learned only from a streamed reply that did not fail and had the vendor's output tokens - left out: the finished row's "Received" metric and the ended caption (layout restraint; an ended row has its own metrics), a duplicate "Received" i18n key, the receive-monitor doc (the design is in gateway-routing.md now), the fork's xmod and Windows CI commits The Routing plugin and i18n.js are outside TestCoreScriptBudget. Run on mote at this head unless named: gofmt -l; go vet (darwin), GOOS=linux -tags nogui and GOOS=windows go vet ./...; go build ./...; go test -race on the live tests; go test ./internal/gateway ./internal/gui (gateway ok; gui red only on TestCoreScriptBudget, #5139, 1533907 > 1533802 before this change and untouched by it, and TestMainWindowCorners/macOS_26_SDK, #3949); routing-live-bytes.test.cjs and i18n-keys in Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and 420px (24/24); every routing-* and panel-routing* GUI file with i18n-keys in WSL Linux (Chromium all green; WebKit reds in 12 files, the same class at origin/main |