[backport 3.2] read view closing performance improvement#12123
Merged
sergepetrenko merged 1 commit intorelease/3.2from Dec 9, 2025
Merged
[backport 3.2] read view closing performance improvement#12123sergepetrenko merged 1 commit intorelease/3.2from
sergepetrenko merged 1 commit intorelease/3.2from
Conversation
Inside `tuple_dictionary_delete_hash`, there was a loop that, on each iteration, searched for the first non-deleted element using `mh_first`, which has a complexity of `O(n)`, and deleted it using `mh_strnu32_del`. After the loop finished executing, `tuple_dictionary_delete_hash` immediately called `mh_strnu32_delete`. All elements are stored in the hashmap inplace, so `del` doesn't invoke any memory deallocation functions. `del` also doesn't call destructors for the elements; it merely sets a specific bit in the bitmap to 0. Immediately after the loop, `mh_strnu32_delete(hash)` will delete the hashmap `hash` along with the array `hash->p` containing all elements inplace. This commit simply removes this useless loop, which was causing significant performance issues when closing a read view. Closes tarantool/tarantool-ee#1043, #12115 NO_DOC=performance improvement NO_TEST=performance improvement (cherry picked from commit 4b72007)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(This PR is a backport of #12019 to
release/3.2to a future3.2.4release.)Inside
tuple_dictionary_delete_hash, there was a loop that, on each iteration, searched for the first non-deleted element usingmh_first, which has a complexity ofO(n), and deleted it usingmh_strnu32_del. After the loop finished executing,tuple_dictionary_delete_hashimmediately calledmh_strnu32_delete.All elements are stored in the hashmap inplace, so
deldoesn't invoke any memory deallocation functions.delalso doesn't call destructors for the elements; it merely sets a specific bit in the bitmap to 0. Immediately after the loop,mh_strnu32_delete(hash)will delete the hashmaphashalong with the arrayhash->pcontaining all elements inplace.This PR simply removes this useless loop, which was causing significant performance issues when closing a read view.
Closes tarantool/tarantool-ee#1043, #12115
NO_DOC=performance improvement
NO_TEST=performance improvement