Skip to main content

Module stats

Module stats 

Source
Expand description

Usage statistics and remembered placeholder values.

Kept apart from the definition files on purpose. Definitions are meant to be tracked in the user’s own git repository; counters that change on every keystroke would make that repository permanently dirty and conflict on every sync.

Ranking uses frecency: each use adds a point, and points decay exponentially. Only the running score and the moment it was last touched are stored, so the cost is two columns per entry rather than a use history.

Structs§

Score
What ranking needs to know about one entry.
Stats

Constants§

HALF_LIFE
How long a score takes to halve, in seconds.
NEW_ENTRY_BONUS
Score a freshly saved command starts at, worth roughly three recent uses.

Functions§

decay
A score after elapsed seconds of decay.
now
Seconds since the Unix epoch.