Skip to content

cleanup(kernel): only try to re-use free blocks before memory.grow#765

Merged
zshipko merged 5 commits intomainfrom
kernel-scan-blocks-less
Sep 19, 2024
Merged

cleanup(kernel): only try to re-use free blocks before memory.grow#765
zshipko merged 5 commits intomainfrom
kernel-scan-blocks-less

Conversation

@zshipko
Copy link
Copy Markdown
Contributor

@zshipko zshipko commented Sep 18, 2024

Updates the kernel to only scan for free blocks before a memory.grow operation, this should improve performance of alloc by not iterating over every block for each allocation.

@zshipko
Copy link
Copy Markdown
Contributor Author

zshipko commented Sep 18, 2024

Just realized this would also change the whole kernel test suite - I will re-open this after doing some more benchmarking to see if it's worth it.

@zshipko zshipko closed this Sep 18, 2024
@zshipko zshipko reopened this Sep 19, 2024
@zshipko
Copy link
Copy Markdown
Contributor Author

zshipko commented Sep 19, 2024

Comparing an example that performs 10,000 allocations with main shows that this branch is a significant improvement:

allocations/allocations time:   [153.68 ms 157.70 ms 161.94 ms]
                        change: [-75.472% -74.562% -73.548%] (p = 0.00 < 0.05)
                        Performance has improved.

@zshipko zshipko changed the title cleanup(kernel): only re-use blocks before memory.grow cleanup(kernel): only try to re-use free blocks before memory.grow Sep 19, 2024
@zshipko zshipko merged commit fa81270 into main Sep 19, 2024
@zshipko zshipko deleted the kernel-scan-blocks-less branch September 19, 2024 22:55
zshipko pushed a commit to extism/go-sdk that referenced this pull request Sep 19, 2024
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.

1 participant