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

MerkleDB Reduce buffer creation/memcopy on path construction #2124

Merged
merged 16 commits into from
Oct 16, 2023

Conversation

dboehm-avalabs
Copy link
Contributor

We only extend immediately after an append. Combine both into a single function to prevent buffers from being created and copied over twice.

x/merkledb/path.go Show resolved Hide resolved

path256 := NewPath([]byte{0b0000_0001}, BranchFactor256)
p = NewPath([]byte{0b0000_0001}, BranchFactor256)
extendedP = path256.Extend(p)
require.Equal([]byte{0b0000_0001, 0b0000_0001}, extendedP.Bytes())
extendedP = path256.AppendExtend(0, p)

Choose a reason for hiding this comment

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

Can we add tests where we don't pass 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is covered in fuzz

x/merkledb/path.go Outdated Show resolved Hide resolved
@@ -306,6 +271,55 @@ func (p Path) Skip(tokensToSkip int) Path {
return result
}

func (p Path) AppendExtend(token byte, path Path) Path {

Choose a reason for hiding this comment

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

I prefer just Extend

x/merkledb/path.go Outdated Show resolved Hide resolved
@danlaine danlaine added this pull request to the merge queue Oct 16, 2023
Merged via the queue into dev with commit 188f2b2 Oct 16, 2023
16 checks passed
@danlaine danlaine deleted the optimizations branch October 16, 2023 17:36
joshua-kim added a commit that referenced this pull request Oct 17, 2023
commit 188f2b2
Author: David Boehm <[email protected]>
Date:   Mon Oct 16 13:10:00 2023 -0400

    MerkleDB Reduce buffer creation/memcopy on path construction (#2124)

    Co-authored-by: Dan Laine <[email protected]>

commit 9d44ec2
Author: Alberto Benegiamo <[email protected]>
Date:   Mon Oct 16 08:53:59 2023 -0700

    Validator Diffs: docs and UTs cleanup (#2037)

    Co-authored-by: Stephen Buttolph <[email protected]>

commit 50f131e
Author: Patrick O'Grady <[email protected]>
Date:   Thu Oct 12 23:04:02 2023 -0700

    [x/merkledb] `Prefetcher` interface (#2167)

commit 007f98d
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Oct 12 22:33:23 2023 -0700

    Bump google.golang.org/grpc from 1.55.0 to 1.58.3 (#2159)

    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Stephen Buttolph <[email protected]>

commit 8d2c4f2
Author: Stephen Buttolph <[email protected]>
Date:   Thu Oct 12 19:44:04 2023 -0400

    Use set.Of rather than set.Add (#2164)

commit 9da2e62
Author: Stephen Buttolph <[email protected]>
Date:   Thu Oct 12 17:41:27 2023 -0400

    Remove context lock from API VM interface (#2165)

commit 9dbf82a
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 19:48:54 2023 -0400

    Remove write lock option from the avm rpc API (#2156)

commit 2eb6e84
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 19:39:44 2023 -0400

    Remove write lock option from the platformvm API (#2157)

commit 9725095
Author: Dhruba Basu <[email protected]>
Date:   Wed Oct 11 14:12:29 2023 -0700

    Remove aliasing of `math` standard lib (#2163)

commit 18fbdef
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 16:57:11 2023 -0400

    Remove lock options from the admin API (#2150)

commit aae7260
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 16:56:13 2023 -0400

    Remove lock options from the IPCs api (#2151)

commit 8247f74
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 16:56:05 2023 -0400

    Remove write lock option from the xsvm API (#2152)

commit 1bc63d4
Author: Dhruba Basu <[email protected]>
Date:   Wed Oct 11 16:34:12 2023 -0400

    Rename `removeSubnetValidatorValidation` to `verifyRemoveSubnetValidatorTx` (#2162)

commit 99fc926
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 12:39:01 2023 -0400

    Fix json marshalling of Sets (#2161)

commit 0f95f13
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 11:37:57 2023 -0400

    Remove write lock option from the avm wallet API (#2155)

commit e6dab5d
Author: Stephen Buttolph <[email protected]>
Date:   Wed Oct 11 11:30:41 2023 -0400

    Remove write lock option from the avm static API (#2154)

commit 7f61fee
Author: Stephen Buttolph <[email protected]>
Date:   Tue Oct 10 23:17:17 2023 -0400

    Remove lock options from the info api (#2149)

commit c50ea11
Author: Stephen Buttolph <[email protected]>
Date:   Tue Oct 10 23:13:19 2023 -0400

    Marshal blocks and transactions inside API calls (#2153)

commit 0ac1937
Author: kyoshisuki <[email protected]>
Date:   Tue Oct 10 20:12:25 2023 -0700

    Fix typo in block formation logic documentation (#2158)

commit 145dfb0
Author: Stephen Buttolph <[email protected]>
Date:   Tue Oct 10 22:18:27 2023 -0400

    Update versions for v1.10.12 (#2139)

commit 6d53e51
Author: Stephen Buttolph <[email protected]>
Date:   Fri Oct 6 18:08:15 2023 -0400

    Split Alpha into AlphaPreference and AlphaConfidence (#2125)

commit 1fc8973
Author: Stephen Buttolph <[email protected]>
Date:   Thu Oct 5 17:50:20 2023 -0400

    Add additional payload.Hash examples (#2145)

    Signed-off-by: Stephen Buttolph <[email protected]>
    Co-authored-by: Dhruba Basu <[email protected]>

Signed-off-by: Joshua Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants