@ 261101.7

261026.49 · 14d2659ed0efc7a2eead879efc66cfde50fdd1c5

README holds what www is, usage, install and a list of docs

The README had grown to 5,700 words. A Notes section of 3,000 words held paragraphs of over 700, and the opening line did not say who www is for. It now says what www reads and for whom, then gives the usage with a few examples, install and one line per doc: 541 words.

The rest moved unchanged into topic files in doc/: options, servers and locks, pages, code pages, search and controls, safety, speed, install and development. A check found every moved sentence in a doc file. The one README sentence doc/history.md lacked, on nested repos, joined it.

TestPageBudget read the README as its large doc. It now joins the README and every doc file, 56 KB against 33 KB before, which renders in 2.4 ms.

reading declarations

Changes to budget_test.go. All files

budget_test.go

@@ -14,22 +14,33 @@ import ( const pageBudget = 5 * time.Millisecond  // Every kind of page renders within pageBudget once its git answers are-// cached: a doc and a code page the size of www's own README and-// render.go, a listing, histories and a commit's diff. Each takes the-// median of 15 runs, so one slow run does not fail it.+// cached: a doc of www's README and every file in doc/ joined, a code+// page of render.go, a listing, histories and a commit's diff. Each takes+// the median of 15 runs, so one slow run does not fail it. func TestPageBudget(t *testing.T) { 	if raceOn { 		t.Skip("the race detector slows every page past the budget") 	} 	needGit(t) 	dir := t.TempDir()-	for _, name := range []string{"README.md", "render.go"} {+	docs, err := filepath.Glob("doc/*.md")+	if err != nil {+		t.Fatal(err)+	}+	var readme []byte+	for _, name := range append([]string{"README.md"}, docs...) { 		b, err := os.ReadFile(name) 		if err != nil { 			t.Fatal(err) 		}-		os.WriteFile(filepath.Join(dir, name), b, 0o644)+		readme = append(append(readme, b...), '\n')+	}+	os.WriteFile(filepath.Join(dir, "README.md"), readme, 0o644)+	b, err := os.ReadFile("render.go")+	if err != nil {+		t.Fatal(err) 	}+	os.WriteFile(filepath.Join(dir, "render.go"), b, 0o644) 	if out, err := exec.Command("git", "init", "-q", dir).CombinedOutput(); err != nil { 		t.Fatalf("git init: %v\n%s", err, out) 	}