Skip to content

miniBDD: store nodes in a std::deque - #9641

Open
kroening wants to merge 1 commit into
developfrom
kroening/minibdd-deque-nodes
Open

kroening wants to merge 1 commit into
developfrom
kroening/minibdd-deque-nodes

Conversation

@kroening

@kroening kroening commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

mini_bdd_mgrt keeps every node in a std::list so that push_back does not
move existing nodes: reverse_map and mini_bddt hold pointers into that
container. Each list node is its own heap allocation, so following a low
or high edge misses the cache. std::deque has the same pointer stability
on push_back, and it packs the 40-byte nodes into blocks (12 per 512-byte
block with libstdc++).

Measured with a stand-alone driver against develop's miniBDD (x86-64,
g++ 11.5 -O2, invariants not checked, pinned to one core, three runs).
Live node counts and result checksums were identical before and after.

Building a 10-bit multiplier, 99,491 live nodes. Seconds, list then deque:
2.405, 2.333, 2.138 -> 1.962, 1.975, 1.860
medians 2.333 s -> 1.962 s (1.19x)

Walking that BDD eight times (f & f, f | f, negation, exists; the build
is not included):
3.044, 2.588, 2.915 -> 2.168, 2.125, 1.976
medians 2.915 s -> 2.125 s (1.37x)

A random mix of and, or, xor, equivalence, not, exists and restrict on a
pool of 16 BDDs, up to about 32,000 live nodes, did not move by more than
the spread across seeds. A 4096-node pool was faster than deque (medians
1.773 s to build and 1.863 s to walk) but is a new container; deque is the
standard one with the required stability.

Result checksums match the list implementation. The node operations are
the ones covered by unit/solvers/bdd/miniBDD.

mini_bdd_mgrt keeps every node in a std::list so that push_back does not
move existing nodes: reverse_map and mini_bddt hold pointers into that
container. Each list node is its own heap allocation, so following a low
or high edge misses the cache. std::deque has the same pointer stability
on push_back, and it packs the 40-byte nodes into blocks (12 per 512-byte
block with libstdc++).

Measured with a stand-alone driver against develop's miniBDD (x86-64,
g++ 11.5 -O2, invariants not checked, pinned to one core, three runs).
Live node counts and result checksums were identical before and after.

Building a 10-bit multiplier, 99,491 live nodes. Seconds, list then deque:
  2.405, 2.333, 2.138 -> 1.962, 1.975, 1.860
  medians 2.333 s -> 1.962 s (1.19x)

Walking that BDD eight times (f & f, f | f, negation, exists; the build
is not included):
  3.044, 2.588, 2.915 -> 2.168, 2.125, 1.976
  medians 2.915 s -> 2.125 s (1.37x)

A random mix of and, or, xor, equivalence, not, exists and restrict on a
pool of 16 BDDs, up to about 32,000 live nodes, did not move by more than
the spread across seeds. A 4096-node pool was faster than deque (medians
1.773 s to build and 1.863 s to walk) but is a new container; deque is the
standard one with the required stability.

Result checksums match the list implementation. The node operations are
the ones covered by unit/solvers/bdd/miniBDD.
@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.35%. Comparing base (7401805) to head (12e90b3).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9641   +/-   ##
========================================
  Coverage    81.34%   81.35%           
========================================
  Files         1727     1727           
  Lines       191753   191752    -1     
  Branches        73       73           
========================================
+ Hits        155986   156001   +15     
+ Misses       35767    35751   -16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant