Repository navigation
Conversation
Contributor
Author
|
TL;DR: the gpui-kit test this PR adds,
|
Contributor
Author
|
TL;DR: merged
|
…eads # Conflicts: # defaults/mods/tabs/main.js
This branch's reader hands mods one shared copy of panes() per revision, which skips read(), where upstream's herdrdev#1015 fills in each terminal pane's scroll. panes_part lays the current scroll numbers over the shared copy and reuses the result while the copy and the numbers are unchanged, so panes().scroll stays live, as herdrdev#1015 documents, and reads still share one copy.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR:
panes(),agents(),terminals()and the other snapshot reads hand the script engine one shared copy per revision instead of converting the whole list on every call, andkeys()is listed again only when keys.json or the mods folder changes. Mod script time per frame roughly halves in a 30-agent layout.Why
serde_json::Value→HostValue→ JavaScript (JS), on every call, even when nothing changed since the last read.keys()re-read keys.json and looked up every mod a binding names on every call; a status-bar mod calls it every render.agentsandworktreemods; this does the same for the shippedtabsmod (it readpanes()twice per tab) and makes each remaining read cheaper for every mod, shipped or not.What changes
HostValue::Json(Arc<serde_json::Value>), host-to-script only. The QuickJS bridge builds the script's copy straight from the shared value (json_into_js). Each call still returns a fresh JS object, so a mod that mutates what it read sees no difference (testa_shared_json_value_reaches_the_script_as_its_own_copy).src/mods.rs:readerservesshared_part(key), copied once per revision of that key (the revisions upstream already keeps to redraw only affected mods).keys()serveskeys_part(), rebuilt when keys.json or the mods folder's modified time changes.defaults/mods/tabs/main.js: readspanes()once per render.defaults/AGENTS.md: one line telling mods each list read is a fresh copy, so read once per render.Numbers
Measured on my fork, whose mod read path matched upstream's apart from this change, with a headless app, a 30-agent layout (5 spaces × 6 tabs) and fake agents switching working/idle; two runs per side, p50 values:
panes()read, 30 panesterminals()read, 30 terminalskeys()readJSON.parsewas tried first and was slower than building the objects (QuickJS's JSON parser).Tests
mods::tests::reads_share_one_copy_of_a_snapshot_part_until_it_changes,mods::tests::keys_are_listed_again_only_when_their_files_change, and the gpui-kit bridge test above.just checkpasses.