Repository navigation
perf(json): indent large JSON, wrap long lines faster, cancel stale JSON renders - #4427
Merged
Merged
Conversation
datlechin
enabled auto-merge (squash)
November 23, 2026 08:43
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.
Summary
Perf audit 2026-11-22b, lane json-views (finding 2; decisions D6, D7).
JsonReindenter: a one-pass byte writer replaces the node-tree writers, same grammar asJsonSyntaxParser. JSON is indented up to 2,000,000 characters, counted on the indented text (D6, option b).normalizecovers sources up to 2,000,000.@StateObject(JsonFieldEditor), built once per field instead of once per parent body. An echo equal to the last synced text is refused before any parse.resolvePendingValuereuses its compact form.reserveCapacityis gone.Numbers
Before:
build/TablePro.app(9d0d481). After: Release build of this branch. Instructions, interleaved runs, medians.wraplinemicro, 1 MiB hex token, 27 columnsbench_json1mbline, 27 columnsbench_json1mbline, 60 columnsreindentmicro, 431 KB, indented / compactbench_json400k, steps 2 to 4, writer passesbench_json1mb, steps 1 to 4bench_json400k, writer passes a stepbench_json1mbrow is measured on this branch merged with main after perf(editor): lay out only the first screen of a long script and keep typing cost flat #4428 (E1). E1 alone does not reach the one-line value of the before build: its cost is wrapping that one line (61 G a step), which JV2 cuts and JV4 replaces with 80,005 indented, highlighted lines that E1 lays out lazily. Plan bar: under 250 ms main (met at the median) and 5 G (not met: 7.3 G, most of it the highlighter's parse of the 1.5 MB indented text off main).Tests changed on purpose
JsonReindenterTests.sizeCap: 500,001 becomes 2,000,001.Deliberately not fixed here
NSTextViewbuilds selection layers over the whole value (0.7 to 1.5 s of main) and each draw walks every line of the fragment (0.55 to 0.83 s a pass). Wrapping touches neither, so the 64 KB limit stays.Typesetter.typesetcounts from quiet pass 2, which has not run.bench_jsontokenin-app row step (JV2): the fixture and harness rows were not added; JV2 is measured with thewraplinemicro.Merge order
Test plan
verify.sh teston 19 suites after merging main with perf(editor): lay out only the first screen of a long script and keep typing cost flat #4428, 206 cases pass: the new and changed cases above, plus pinnedTypesetterWrapLengthTests,SQLEditorLongLineScrollTests,ValueStandInThemeTests,InspectorRowChangeTests,CellEditorArrowExitTests,DataGridTextEditorPopoverTestsand the rest of each touched suite.WelcomeConnectionListUITests.testTheToolbarFiltersByTagAndSearchesTheList, red on main since perf(welcome): own the toolbar and search in AppKit #4415; fix(welcome): act on the whole query when Return leaves the search field #4432 fixes it.LineBreakCharactersagainst the old rule at every offset of 2,000 generated strings (lone surrogates, combining marks, Prepend, ZWJ, supplementary punctuation, CRLF); search-window edges; the byte writer against the node-tree layout over a corpus with every truncation of one document and 511 to 513 levels; one case per caller between 500,000 and 2,000,000 characters; the UTF-16 cap at its boundary; one model per field across parent bodies; a cancelled render; 50,001 rows report 50,000.