Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT witgen code generation performance through occurrence maps #2342

Open
chriseth opened this issue Jan 15, 2025 · 0 comments
Open

JIT witgen code generation performance through occurrence maps #2342

chriseth opened this issue Jan 15, 2025 · 0 comments

Comments

@chriseth
Copy link
Member

For large number of identities (arith256_memory), it takes a long time to go through the full list of identities.

Instead, we should create a map from all variables to the identities they occur in. Once we get an update about the information of a variable, we only take a look at the identities the variable occurs in.

We could still try to always try to process the identities in source order, but that should not be a problem:

We can maintain a sorted queue or something:

// TODO maybe better to use a BinaryHeap
let mut identities_to_process: BTreeMap<usize, &Identity<T>> = all_identities(); // the usize is the index
while let Some((index, id)) = identities_to_process.pop_first() {
  // We don't need `progress` any more, since "progress" just means "at least one var was updated"
  let updated_vars = process_identity(id);
  identities_to_process.extend(updated_vars.iter().flat_map(|v| &occurrence[v]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant