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

Enable static simple predicates #417

Merged
merged 13 commits into from
Aug 18, 2023
Merged

Enable static simple predicates #417

merged 13 commits into from
Aug 18, 2023

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Aug 17, 2023

Since these are very commonly used types, optimise them a bit by adding a dedicated internal representation.

Fortunately the check for constructing them is easy.

Closes #397

@ss2165 ss2165 requested a review from cqc-alec August 17, 2023 10:02
@@ -46,7 +46,7 @@ impl Const {
}

/// Constant Sum over units, used as predicates.
pub fn simple_predicate(tag: usize, size: usize) -> Self {
pub fn simple_predicate(tag: usize, size: u8) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why restrict to u8?

/// of a "simple predicate" (sum over empty tuples), store only the size of the predicate.
enum SumType {
#[display(fmt = "SimplePredicate({})", "_0")]
Simple(u8),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use usize here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thinking being that simple predicates branching factor >255 is not worth optimising for, and u8 will allow memory and serialisation optimisations.

Base automatically changed from refactor/resource2extension to main August 18, 2023 09:56
@ss2165 ss2165 enabled auto-merge August 18, 2023 10:00
@ss2165 ss2165 added this pull request to the merge queue Aug 18, 2023
Merged via the queue into main with commit 8aff60e Aug 18, 2023
6 checks passed
@ss2165 ss2165 deleted the new/predicate-opt branch August 18, 2023 10:03
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

Successfully merging this pull request may close these issues.

More efficient representation (memory and serialised) for "simple predicate" types
2 participants