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

[Execution state] Reduce memory allocs by reusing same immutable empty payload #1872

Closed
fxamacker opened this issue Jan 20, 2022 · 1 comment
Assignees
Labels
Execution Cadence Execution Team Performance

Comments

@fxamacker
Copy link
Member

Problem

We're creating a new empty payload (struct with 2 slices) on the heap each time one is needed.

Scenarios that create empty payloads include:

  • read() creates new empty payloads when we try to read a non-existent path
  • Forest.Proofs() creates new empty payloads to generate proof for non-existent path

And all payloads are deep copied upon read from the trie and update to the trie.

The Proposed Solution

Reuse the same immutable empty payload instead of creating a new one each time.

Updates epic #1744

@fxamacker fxamacker self-assigned this Jan 20, 2022
@fxamacker fxamacker added the Execution Cadence Execution Team label Jun 16, 2022
@fxamacker
Copy link
Member Author

I'm closing this issue because it doesn't seem like it would have enough impact to be worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Execution Cadence Execution Team Performance
Projects
None yet
Development

No branches or pull requests

1 participant