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

Slotted array faster defragmentation #364

Merged
merged 4 commits into from
Jun 27, 2024
Merged

Conversation

Scooletz
Copy link
Contributor

@Scooletz Scooletz commented Jun 26, 2024

This PR changes the SlottedArray.Defragment method that is clearly visible in traces and previously was copying data twice, once from the array to a buffer, then buffer to an array. This PR removes the need of the auxiliary buffer which required renting & releasing but also introduced one more copy.

The benchmarks below does not show the gains that are observed. P95 of the block application to the database dropped by ~20% which is a lot.

Benchmark

Before

Method Mean Error StdDev Code Size
Defragment_first_key_deleted 372.76 ns 3.585 ns 3.178 ns 7,438 B
Defragment_last_key_deleted 30.19 ns 0.473 ns 0.443 ns 5,609 B

After

Method Mean Error StdDev Code Size
Defragment_first_key_deleted 258.77 ns 2.896 ns 2.567 ns 5,553 B
Defragment_last_key_deleted 29.75 ns 0.274 ns 0.256 ns 5,607 B

@Scooletz Scooletz added the 🐌 performance Perofrmance related issue label Jun 26, 2024
Copy link

Code Coverage

Package Line Rate Branch Rate Health
Paprika 85% 80%
Summary 85% (4194 / 4925) 80% (1347 / 1682)

Minimum allowed line rate is 75%

@Scooletz Scooletz marked this pull request as ready for review June 27, 2024 05:38
@Scooletz Scooletz merged commit 4366d00 into main Jun 27, 2024
2 checks passed
@Scooletz Scooletz deleted the slotted-array-faster-defrag branch June 27, 2024 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐌 performance Perofrmance related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant