Skip to content

chore: make EncodeAscii ghost #1622

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

Merged
merged 53 commits into from
Apr 14, 2025
Merged

chore: make EncodeAscii ghost #1622

merged 53 commits into from
Apr 14, 2025

Conversation

ajewellamz
Copy link
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

seebees and others added 8 commits November 1, 2024 13:06
The `Below` function is in the hot path.
The slice (x[1..]) operation is not optimized in Dafny.
This optimizes this function by turning the recursive slice
into a loop over an index into the seq.
Further, a bounded integer version is also included.
The `MergeSort` function is in the hot path.
The slice (x[1..]) operation is not optimized in Dafny.
This optimizes this function by turning the recursive slice
into a loop over an index into the seq.
Further, a bounded integer version is also included.

It also limits the total amount of data copied.
@ajewellamz ajewellamz requested a review from a team as a code owner February 5, 2025 00:07
@ajewellamz ajewellamz changed the base branch from main to ajewell/measure March 14, 2025 15:51
Copy link
Contributor

@texastony texastony left a comment

Choose a reason for hiding this comment

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

I reviewed some things; but this a lot of code to read...

}

// Return the sum of the sizes of the given fields
function method {:opaque} SumValueSize(fields : CanonCryptoList)
function {:opaque} SumValueSize(fields : CanonCryptoList)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Check with the Dafny team during their office hours,
but I had great success with the hide * syntax while working on Mutations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand. Check with the Dafny team about what? Is something amiss here?

@ajewellamz ajewellamz changed the base branch from ajewell/measure to main April 9, 2025 18:57
Copy link
Contributor

@lucasmcdonald3 lucasmcdonald3 left a comment

Choose a reason for hiding this comment

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

Could you update the commit message? Maybe
chore: improve performance
seems more accurate and is much happier

@@ -289,7 +290,7 @@ module CompoundBeacon {
// return all the fields involved in this beacon
function method GetFields(virtualFields : VirtualFieldMap) : seq<string>
{
Seq.Flatten(Seq.Map((p : BeaconPart) => p.GetFields(virtualFields), parts))
Sequence.Flatten(Seq.Map((p : BeaconPart) => p.GetFields(virtualFields), parts))
Copy link
Contributor

Choose a reason for hiding this comment

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

(Curious) what was the performance issue with the original flatten?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original Flatten recurses on seq[1..], which makes a copy.
The new Flatten recurses on position+1, so no copy is made.

@ajewellamz ajewellamz merged commit 8ca2883 into main Apr 14, 2025
41 checks passed
@ajewellamz ajewellamz deleted the ajewell/ghost-encode-ascii branch April 14, 2025 22:21
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.

4 participants