@ 261101.7

261028.11 · 86c22266c9aee40202c9a1be33bbef492e65ae07

A tree page renders its rows while the helper still prints them

The helper prints in 64 KB chunks as it walks the tree, but www waited for it to exit before reading a line. Now www reads the pipe as it fills and writes each row once the next shows whether it folds. Kind and field names are kept once each, so a row costs no allocation.

The page itself no longer copies the tree on its way out: the body and the page buffer are sized for it. The tree cache charges the buffer the rows were built in, since it may be larger than the rows.

On jquery.js a first view went from 97 to 85 ms in make bench, and from 40 to 27 MB allocated. The helper's parse, about 45 ms, is now most of what remains. The output is byte for byte the same on 739 files.

reading declarations

Changes to semantic.go. All files

semantic.go

@@ -97,7 +97,7 @@ func scopeKind(kind string) bool { // helper's syntax tree. Locals, such as a function's variables, are left // out; a member is qualified by its container, eg Parser.parse. func declarations(ctx context.Context, name string, src []byte) ([]decl, error) {-	nodes, err := parseSyntax(ctx, name, src)+	nodes, err := syntaxNodes(ctx, name, src) 	if err != nil { 		return nil, err 	}