Repository navigation
CsrTs: real compressed sparse rows, nondeterministic, any alphabet - #166
Merged
Merged
Conversation
CsrTs now stores its edges (expression, color, target) in one vector sorted by source behind one offset per state, instead of a dense n*k table. It is nondeterministic and works for any Alphabet; Det<CsrTs> is the deterministic variant (row scan lookup). Incoming edges are collected on first use. - Storage markers: Csr (nondeterministic) and Det<Csr>. - Builder::into_csr/into_det_csr (and try_ twins) build it in one pass. - Alphabet::covers; States::is_complete uses it, propositional alphabets join expressions instead of enumerating symbols. - PERFORMANCE.md updated with measurements.
Owner
Author
Benchmarks
All 266 benchmarks
Instruction counts under valgrind on (), rustc 1.95.0 (59807616e 2026-04-14) (built from a source tarball), one execution per revision. A change counts if it is above 2 %. Wall-clock times are on the dashboard. |
- Look up the matching edge in one pass over the row (one bounds check for the offsets, no second index into the edge vector). - Incoming edges are stored as (source, position) pairs instead of searching the offsets for the source of every edge. - ReverseCsr moves back to dense.rs with its slice-based build; CsrTs no longer uses it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
CsrTswas a frozenDenseTswith an eager reverse CSR. It is now a real forward CSR:u32offset per state;EdgeId= positionAlphabet;Det<CsrTs>is the deterministic variant (lookup scans the row)predecessorscall (OnceLock<ReverseCsr>)collectonly;Builder::into_csr/into_det_csr(+try_) build it in a single passCsr(nondeterministic),Det<Csr>Alphabet::covers:States::is_completejoins expressions (BDD/table union vs. universal) for propositional alphabets instead of enumerating symbolsBreaking (see CHANGELOG): a deterministic
CsrTsis nowDet<CsrTs>;Csrmarker is nondeterministic;EdgeIds changed meaning.Measurements (gungraun, 2000 states, sum of targets over
edges_from; instructions / est. cycles)CsrTsCsrTsDet<LinkedTs>Lookups (
successor, runs) are a row scan now and will be slower than before;DenseTsremains the choice for constant-time lookup. The existingedges_from_all_states_*benchmarks onlycount()and don't reflect the gain (not changed here, names are tracked).Notes
DenseTsedges_from showed more instructions than onmainin the same ad-hoc measurement although unchanged; not investigated.ReverseCsrstill lives incsr.rsand is shared withDenseTs../scripts/checkpasses.