chore: make EncodeAscii ghost#1622
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.
texastony
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
I don't understand. Check with the Dafny team about what? Is something amiss here?
lucasmcdonald3
left a comment
There was a problem hiding this comment.
Could you update the commit message? Maybe
chore: improve performance
seems more accurate and is much happier
| 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.
(Curious) what was the performance issue with the original flatten?
There was a problem hiding this comment.
The original Flatten recurses on seq[1..], which makes a copy.
The new Flatten recurses on position+1, so no copy is made.
## [3.9.0](v3.8.1...v3.9.0) (2025-06-25) ### Features * **Go:** support DB-ESDK in Go ([#1861](#1861)) ([56821de](56821de)) ### Maintenance * **CI:** Fix Dafny CLI CI error ([#1910](#1910)) ([97fe459](97fe459)) * **dafny:** Add ExecuteStatement test ([#1932](#1932)) ([66a19ab](66a19ab)) * **dafny:** Add Update and delete test ([#1942](#1942)) ([3bd48ba](3bd48ba)) * **dafny:** bump mpl version ([#1933](#1933)) ([0ebc112](0ebc112)) * **dafny:** change nat to uint64 in many places ([#1852](#1852)) ([ec22b7d](ec22b7d)) * **dafny:** further performance enhancements ([#1834](#1834)) ([ea94693](ea94693)) * **dafny:** improve performance ([#1900](#1900)) ([ccf61d6](ccf61d6)) * **dafny:** improve performance of searchable encryption ([#1931](#1931)) ([8b71004](8b71004)) * **dafny:** reduce use of BigInteger ([#1872](#1872)) ([eb7679a](eb7679a)) * **dafny:** test ExecuteTransaction and BatchExecuteStatement ([#1941](#1941)) ([69c37c6](69c37c6)) * **deps:** Bump MPL version to 1.11.0 ([#1945](#1945)) ([efdd373](efdd373)) * **dotnet:** copy all the JSON for testvectors CI ([#1921](#1921)) ([58b39a7](58b39a7)) * fix Java release script ([#1944](#1944)) ([ada96d7](ada96d7)) * further performance improvements ([#1826](#1826)) ([3194054](3194054)) * **go:** add item encryptor and misc examples ([#1873](#1873)) ([45ec157](45ec157)) * **go:** fix restore logic for polymorph copied code ([#1935](#1935)) ([e2d76c3](e2d76c3)) * **go:** Update code generation CI to check Go polymorph code ([#1936](#1936)) ([6e1e48c](6e1e48c)) * improve performance ([#1622](#1622)) ([8ca2883](8ca2883)) * install smithy-dafny dependencies in github workflows ([#1890](#1890)) ([fc64e62](fc64e62)) * **java:** allow local testing ([#1779](#1779)) ([42be20b](42be20b)) * **java:** Parallelize Java Examples ([#1940](#1940)) ([b532564](b532564)) * restore static test branch key id ([#1790](#1790)) ([c67e3c9](c67e3c9)) * run test vectors in net and java on MacOS ([#1844](#1844)) ([10f530b](10f530b)) * **rust:** get latest fixes for dafny-runtime-rust ([#1924](#1924)) ([245ad31](245ad31)) * **rust:** prepare 1.1.1 release ([#1937](#1937)) ([6173888](6173888)) * **rust:** Rust release version 1.1.0 ([#1885](#1885)) ([f2997be](f2997be)) * **rust:** update dafny runtime release ([#1884](#1884)) ([0e4fd02](0e4fd02)) * **TestVectors:** Test Smithy-generated ItemEncryptor ([#1814](#1814)) ([ba9caca](ba9caca)) * update README for missing info ([#1939](#1939)) ([354f4f6](354f4f6))
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.