Skip to content

book: a faster shape is measured beside its neighbours, and a mutant is one when the built program differs - #745

Open
closer-claudio wants to merge 2 commits into
mainfrom
claudio/20261123-neighbours-and-mutants
Open

closer-claudio wants to merge 2 commits into
mainfrom
claudio/20261123-neighbours-and-mutants

Conversation

@closer-claudio

Copy link
Copy Markdown
Contributor

🎯 Why

Two gaps in the testing chapter, each met in a change last night.

  • A faster shape, a slower neighbour. An image writer replaced a walk of the whole tree with a kept list of a file's other names: removing the first names of 16,000 linked files went from 1.27 s to 3 ms (Removing the first names of many linked files grows with their number, not with its square: 16,000 in 3 ms instead of 1.3 s forkcloser/erofs#298). The shape beside it, many names of one file, never made the walk; with each removed name taken out of the list it would have cost the square of the names. The chapter asked for a benchmark before and after on the shape the consumer runs, and said nothing of the shapes beside it.
  • A mutant with a correct diff that was none. The chapter said a mutant is one when the mutated tree differs, and named the diff as the check. A leak planted in C as a bare malloc(32), its result unread, was removed by the compiler; the test it was meant to fail passed, and the diff read right (Audit the repository forkcloser/taciturn#98).

🛠️ What

  • Speed (testing.md L108-L111): a change that makes one shape faster is measured on the shapes beside it too, against the base. One row for the case in the Go chapter's table (testing-go.md L102).
  • Mutation (testing.md L164-L171): a mutant is one when the program built from it differs. The diff shows the edit was made; the figures the test prints under the mutant show it reached the binary.

🧪 How

closer-claudio and others added 2 commits November 23, 2026 00:30
The testing chapter has a benchmark run before and after a change to the
hot path, on the shape the consumer runs. An image writer replaced a walk
of the whole tree with a kept list of a file's other names: removing the
first names of 16,000 linked files went from 1.27 s to 3 ms. The shape
beside it, many names of one file, never made the walk; with each removed
name taken out of the list it would have cost the square of the names. It
shipped measured on four neighbouring shapes, against the base, with the
list left alone on such a removal.

One sentence in the chapter's item on speed, and the case in the Go
chapter's table.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
The mutation paragraph said a mutant is one only when the mutated tree
differs, and that the diff is the positive control. A day later a mutant
with a correct diff was none: a leak planted in C as a bare malloc(32),
its result unread, to prove a growth test sees a leak. clang removes such
a call at -O2, cgo's default (checked here: one call to malloc at -O0,
none at -O2, one when the result goes to a volatile pointer). The test
passed under it, and that was the only sign.

The paragraph now says what each check shows: the diff, that the edit was
made; the figures the test prints under the mutant, that the edit reached
the binary.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
@closer-claudio closer-claudio added the internal Changes nothing for a consumer; left out of release notes label Nov 23, 2026
@closer-claudio

Copy link
Copy Markdown
Contributor Author

Reviewed at e3421e9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Changes nothing for a consumer; left out of release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant