What a KB is asked, and what each answer costs the index: seven tallies behind one
switch. :goals (retrieval decisions by shape and access path), :reads (IndexStore
reads by family), :fan (trie walks and node probes), :sift (candidates returned,
unified and matched), :fetches (RecordStore reads by kind), :writes and :retracts
(per-family index cost by functor). The switch and the store are one atom, nil when off, so
every call site is a deref and a nil? check. A goal's key is [functor polarity adornment path], one adornment character per argument: b ground atom, B ground
compound, n ground token the roots do not key, f open atom, F open compound. See
docs/profile.md.
What a KB is asked, and what each answer costs the index: seven tallies behind one switch. `:goals` (retrieval decisions by shape and access path), `:reads` (`IndexStore` reads by family), `:fan` (trie walks and node probes), `:sift` (candidates returned, unified and matched), `:fetches` (`RecordStore` reads by kind), `:writes` and `:retracts` (per-family index cost by functor). The switch and the store are one atom, nil when off, so every call site is a deref and a `nil?` check. A goal's key is `[functor polarity adornment path]`, one adornment character per argument: `b` ground atom, `B` ground compound, `n` ground token the roots do not key, `f` open atom, `F` open compound. See docs/profile.md.
nil, or a fn of one handle, called with each sentex handle a RecordStore fetch reads
(record-fetch's two-argument arity) and each handle an IndexStore posting read
answers (record-posting). The handle twin of reads/*contexts-read*: a test binds it
around a write to bound the stored sentexes the write reads (padding_blindness_test).
A count, a child-token or a name-set read answers no handle and calls nothing.
nil, or a fn of one handle, called with each sentex handle a `RecordStore` fetch reads (`record-fetch`'s two-argument arity) and each handle an `IndexStore` posting read answers (`record-posting`). The handle twin of `reads/*contexts-read*`: a test binds it around a write to bound the stored sentexes the write reads (`padding_blindness_test`). A count, a child-token or a name-set read answers no handle and calls nothing.
(profiling?)Is the instrument collecting?
Is the instrument collecting?
(record-fan pattern visits widest handles)Tally one trie walk: visits node probes, a frontier that reached widest, and
handles handles at the terminus. Keyed by the path's first token, which is the
functor for a positive fact and :false for a negative.
Tally one trie walk: `visits` node probes, a frontier that reached `widest`, and `handles` handles at the terminus. Keyed by the path's first token, which is the functor for a positive fact and `:false` for a negative.
(record-fetch kind)(record-fetch kind id)Tally one RecordStore read against its kind, one of the seven :fetches names in the
namespace docstring. The record-store twin of record-read: a read tally cannot see a
fetch per candidate handle. Keyed by kind, not by handle or functor. A deref and a
nil? check when the instrument is off. With id, the fetched record's handle also goes
to *handle-sink*.
Tally one `RecordStore` read against its kind, one of the seven `:fetches` names in the namespace docstring. The record-store twin of `record-read`: a read tally cannot see a fetch per candidate handle. Keyed by kind, not by handle or functor. A deref and a `nil?` check when the instrument is off. With `id`, the fetched record's handle also goes to `*handle-sink*`.
(record-goal pat path)Tally one candidate-handles decision: the pattern sentex it was asked for and the
access path it chose. A deref and a nil? check when the instrument is off.
Tally one `candidate-handles` decision: the pattern sentex it was asked for and the access path it chose. A deref and a `nil?` check when the instrument is off.
(record-index-retract sentex counts)Tally one unindex-sentex!: the same families as record-index-write plus :dead, the
trie nodes this retraction emptied. :dead depends on what else is stored under the same
prefix, so it is a tally of its own.
Tally one `unindex-sentex!`: the same families as `record-index-write` plus `:dead`, the trie nodes this retraction emptied. `:dead` depends on what else is stored under the same prefix, so it is a tally of its own.
(record-index-write sentex counts)Tally one index-sentex: how many trie levels it touched and how many keys each of
the flat families took. Call sites guard on profiling? so the counts map is built
only while collecting.
Tally one `index-sentex`: how many trie levels it touched and how many keys each of the flat families took. Call sites guard on `profiling?` so the counts map is built only while collecting.
(record-literal sentence path)Tally one retrieval decision taken over a bare sentence rather than a pattern sentex — the set-algebra matcher's, which is handed the literal and admits only positive ones.
Tally one retrieval decision taken over a bare sentence rather than a pattern sentex — the set-algebra matcher's, which is handed the literal and admits only positive ones.
(record-posting hs)hs, the handles one IndexStore read answers, after passing each to
*handle-sink* when it is bound.
`hs`, the handles one `IndexStore` read answers, after passing each to `*handle-sink*` when it is bound.
(record-read family)Tally one IndexStore read against the family that answered it. This is the tally
that says whether a family pays for itself, so the names are the families and not the
method names: several methods read the argument roots, and what a policy would drop is
the family.
Tally one `IndexStore` read against the family that answered it. This is the tally that says whether a family pays for itself, so the names are the families and not the method names: several methods read the argument roots, and what a policy would drop is the family.
(record-sift sentence path returned matched unified)Tally one hierarchical retrieval's three widths: candidate handles the argument-root probe
(lead-candidates) handed the matcher (returned), those that reached unify after the
liveness, predicate and context filters (unified), and those that matched (matched).
Keyed by the literal's shape and the retrieval path, like :goals. The call site realizes
the full candidate seq only while collecting. The args are unhinted because a fn taking
primitive longs is capped at four.
Tally one hierarchical retrieval's three widths: candidate handles the argument-root probe (`lead-candidates`) handed the matcher (`returned`), those that reached `unify` after the liveness, predicate and context filters (`unified`), and those that matched (`matched`). Keyed by the literal's shape and the retrieval path, like `:goals`. The call site realizes the full candidate seq only while collecting. The args are unhinted because a fn taking primitive `long`s is capped at four.
(shape-of body polarity path)One literal's tally key, [functor polarity adornment path]. Public because the oracle
asks for a shape directly rather than inferring it from a count.
One literal's tally key, `[functor polarity adornment path]`. Public because the oracle asks for a shape directly rather than inferring it from a count.
(snapshot)The tallies so far as plain data, or nil when the instrument is off:
{:elapsed-ms how long this run has been collecting :goals {[functor polarity adornment path] count} :reads {family count} :fan {first-token {:calls :visits :widest :handles :decades {n count}}} :sift {[functor polarity adornment path] {:calls :returned :unified :matched}} :fetches {kind count} :writes {functor {:asserts :levels :terms :roots :term-names :slots}} :retracts {functor {:retracts :levels :terms :roots :term-names :slots :dead}}}
The tallies so far as plain data, or nil when the instrument is off:
{:elapsed-ms how long this run has been collecting
:goals {[functor polarity adornment path] count}
:reads {family count}
:fan {first-token {:calls :visits :widest :handles :decades {n count}}}
:sift {[functor polarity adornment path] {:calls :returned :unified :matched}}
:fetches {kind count}
:writes {functor {:asserts :levels :terms :roots :term-names :slots}}
:retracts {functor {:retracts :levels :terms :roots :term-names :slots :dead}}}(start)Begin collecting, dropping whatever a previous run left. Bare, not !: a tally is
derived from a workload nobody stored, so nothing it holds is knowledge and re-running
the workload recomputes it.
Begin collecting, dropping whatever a previous run left. Bare, not `!`: a tally is derived from a workload nobody stored, so nothing it holds is knowledge and re-running the workload recomputes it.
(stop)Stop collecting and return the final snapshot (nil when it was not running).
One CAS rather than a deref and a reset!: the reading taken and the instrument
cleared are the same step, so a tally filed between the two is reported rather than
wiped unread.
Stop collecting and return the final snapshot (nil when it was not running). One CAS rather than a deref and a `reset!`: the reading taken and the instrument cleared are the same step, so a tally filed between the two is reported rather than wiped unread.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |