How much do you have to read?

Bring a file, type a query, and race three ways of finding it: grep reads everything, rg skips through everything, a trigram index opens only the sections that could match.

Read the essay
fig. 01 / index move along the shelf: grep, rg, ngram rest
grep
Reads every character of every section, left to right.
rg
Still visits every section, but compares right to left and jumps ahead on a mismatch.
ngram
Looks up the query's three-letter pieces in an index first, then reads only the sections on every list.