Skip to content

Specialize the container type for antichains #462

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

antiguru
Copy link
Member

Antichains are currently unconditionally heap-allocated. For totally
ordered elements, an antichain will container zero or one elements, but not
more. This would allow us to avoid the heap allocation and instead store
the element inline.

To enable this, we add an associated type to Timestamp that defines a
container storing an antichain of the type. The container implements the
functionality to let the current Antichain type function without change.

The obvious downside of this change is that we now include a type bound
T: Timestamp on the Antichain type, because the elements are based on
T's associated type, which infects a bunch of other places.

Signed-off-by: Moritz Hoffmann [email protected]

@antiguru antiguru force-pushed the timestamp_container branch from b00a8f1 to 56b10fa Compare August 11, 2022 09:28
@antiguru
Copy link
Member Author

This PR has the deficit that it's not possible to create a Antichain<Capability<T>> anymore because it requires the generic parameter to Antichain to be Timestamp. Capability cannot implement Timestamp as it cannot offer a minimum function.

This functionality is required by Differential. I don't think there's a good work-around other than splitting the Timestamp trait in what it currently is plus a TimstampStorage that only carries the associated storage type, but it's rather ugly and I don't know that it actually works.

antiguru added 2 commits March 9, 2023 13:23
Antichains are currently unconditionally heap-allocated. For totally
ordered elements, an antichain will container zero or one elements, but not
more. This would allow us to avoid the heap allocation and instead store
the element inline.

To enable this, we add an associated type to `Timestamp` that defines a
container storing an antichain of the type. The container implements the
functionality to let the current `Antichain` type function without change.

The obvious downside of this change is that we now include a type bound
`T: Timestamp` on the `Antichain` type, because the elements are based on
`T`'s associated type, which infects a bunch of other places.

Signed-off-by: Moritz Hoffmann <[email protected]>
@antiguru antiguru force-pushed the timestamp_container branch from 56b10fa to 4ab758d Compare March 9, 2023 18:23
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.

1 participant