TreePseudoLru class

Tree pseudo-LRU replacement over integer state and masks.

This is the software form of the recursive formulation used by TreePseudoLruReplacement: the entries [start, end) of a node split at middle = (start + end) ~/ 2, the node's left child is 2 * node + 1 and its right child is 2 * node + 2. State bit node is one when the left half was used more recently, so the right half is preferred for replacement. Each operation walks one root-to-leaf path, so updates and selections take time proportional to the tree depth.

State and candidate masks use bit i for node or entry i, which limits entryCount to nativeMaskBits.

Constructors

TreePseudoLru(int entryCount)
Creates the algorithm for entryCount entries.

Properties

entryCount → int
Number of entries; a power of two.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stateWidth → int
Number of state bits, matching the hardware register.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
select(int state, int candidates) → int?
The entry state selects among candidates, or null if none.
toString() → String
A string representation of this object.
inherited
touch(int state, int index) → int
Returns state after using index, marking its path most recent.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

nativeMaskBits → const int
Low integer bits usable as a mask: 31 on the web, otherwise 63.