Skip to content

Conversation

zshipko
Copy link
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
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
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
6 checks passed
@zshipko zshipko deleted the kernel-scan-blocks-less branch September 19, 2024 22:55
zshipko added 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