-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conversation
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.
There was a problem hiding this 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...
DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy
Outdated
Show resolved
Hide resolved
DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy
Outdated
Show resolved
Hide resolved
} | ||
|
||
// Return the sum of the sizes of the given fields | ||
function method {:opaque} SumValueSize(fields : CanonCryptoList) | ||
function {:opaque} SumValueSize(fields : CanonCryptoList) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this 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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.