Liking cljdoc? Tell your friends :D

vaelii.impl.types.trie

The columnar index's mutable int-token trie, as a held namespace (vaelii.impl.types.prover states what that means). Trie mutates its own fields, which only its inline methods can do, so the type and the code it calls live here together; it calls only held namespaces. The IndexStore over it is vaelii.impl.columnar.

The columnar index's mutable int-token trie, as a held namespace
(`vaelii.impl.types.prover` states what that means).  `Trie` mutates its own fields,
which only its inline methods can do, so the type and the code it calls live here
together; it calls only held namespaces.  The `IndexStore` over it is
`vaelii.impl.columnar`.
raw docstring

init-capclj

source

make-trieclj

(make-trie dict)
source

promote-atclj

How many child edges a trie node holds as the sorted int[] pair before its edges become one primitive hash map — and, at half of this, drop back to the pair.

The pair is the better structure while a node is narrow: two primitive arrays, no object header between them and the data, and a binary search over a run short enough to sit in a cache line or two. What it cannot do is grow cheaply, since minting an edge splices both arrays. 64 is where the two costs cross — the splice is still one short arraycopy, and a hash map's tables (over-provisioned to a 0.75 load factor, plus the object) are still bulkier than the pair they would replace, which matters because nearly every node in a real trie is on this side of the line.

Dropping back at half rather than at the same width is hysteresis: a node sitting exactly on the boundary would otherwise rebuild its whole edge structure on every add/remove pair, and one rebuild per promote-at/2 operations is amortized O(1).

How many child edges a trie node holds as the sorted `int[]` pair before its edges
become one primitive hash map — and, at half of this, drop back to the pair.

The pair is the better structure while a node is narrow: two primitive arrays, no
object header between them and the data, and a binary search over a run short enough to
sit in a cache line or two.  What it cannot do is grow cheaply, since minting an edge
splices both arrays.  64 is where the two costs cross — the splice is still one short
`arraycopy`, and a hash map's tables (over-provisioned to a 0.75 load factor, plus the
object) are still bulkier than the pair they would replace, which matters because
nearly every node in a real trie is on this side of the line.

Dropping back at *half* rather than at the same width is hysteresis: a node sitting
exactly on the boundary would otherwise rebuild its whole edge structure on every
add/remove pair, and one rebuild per `promote-at`/2 operations is amortized O(1).
sourceraw docstring

PTriecljprotocol

t-lookupclj

(t-lookup t pattern)

Handles whose full path matches pattern (variables fan out; markers skip).

Handles whose full path matches `pattern` (variables fan out; markers skip).

t-install-csr!clj

(t-install-csr! t sections)

Install CSR sections read from a snapshot (leaves may be mapped buffers).

Install CSR sections read from a snapshot (leaves may be mapped buffers).

t-leaves-atclj

(t-leaves-at t prefix)

Leaf handles exactly at a prefix (a set, #{} if absent).

Leaf handles exactly at a prefix (a set, #{} if absent).

t-clear!clj

(t-clear! t)

Reset to a single empty root (the dict is wiped by the store).

Reset to a single empty root (the dict is wiped by the store).

t-count-atclj

(t-count-at t prefix)

Subtree leaf count at a path prefix (0 if absent).

Subtree leaf count at a path prefix (0 if absent).

t-child-countclj

(t-child-count t prefix)

How many child edges sit at a prefix — the width, without decoding it.

How many child edges sit at a prefix — the width, without decoding it.

t-remove!clj

(t-remove! t path handle)

Remove handle from path's leaf, pruning nodes that empty; answers how many of the path's own nodes emptied, or -1 when handle was not at that leaf (the path absent, or the handle never there) — nothing was removed and nothing counted down.

Remove `handle` from `path`'s leaf, pruning nodes that empty; answers how many of the path's own nodes emptied, or **-1** when `handle` was not at that leaf (the path absent, or the handle never there) — nothing was removed and nothing counted down.

t-childrenclj

(t-children t prefix)

Decoded child edge tokens at a prefix (a vector, [] if absent).

Decoded child edge tokens at a prefix (a vector, [] if absent).

t-mapped?clj

(t-mapped? t)

Are the leaf columns an mmap'd snapshot rather than heap arrays?

Are the leaf columns an mmap'd snapshot rather than heap arrays?

t-compact!clj

(t-compact! t)

Freeze the mutable trie into flat CSR arrays (read-optimized, dense).

Freeze the mutable trie into flat CSR arrays (read-optimized, dense).

t-insert!clj

(t-insert! t path handle)

Insert a sentex handle at the leaf of path (a token seq).

Insert a sentex handle at the leaf of `path` (a token seq).

t-csrclj

(t-csr t)

The frozen CSR sections as a map, or nil while mutable.

The frozen CSR sections as a map, or nil while mutable.
source

trie-entriesclj

(trie-entries trie)

Every node of trie as [[:trie :count|:children|:handles prefix] value], in the flat index's own key shape. Lazy and depth-first, so a corpus-sized trie streams.

Every node of `trie` as `[[:trie :count|:children|:handles prefix] value]`, in the flat
index's own key shape.  Lazy and depth-first, so a corpus-sized trie streams.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close