Repository navigation
Rework Vector_softRemove() and compact() operations - #1782
Merged
Merged
Conversation
BenBE
approved these changes
Oct 9, 2025
BenBE
left a comment
Member
There was a problem hiding this comment.
Looks good on first glance. Still need to test locally though.
Explorer09
force-pushed
the
vector-dirty
branch
from
October 10, 2025 11:31
34d5e8a to
5e4e347
Compare
Rename the DEFAULT_SIZE macro to VECTOR_DEFAULT_SIZE and hard-code the size value (10) in the macro rather than use a (-1) flag. This makes room for the 'Vector.size' member to migrate to an unsigned type. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Use a goto label when a table row should be removed. No changes to code behavior.
Remove the 'dirty_index' and 'dirty_count' members of Vector object. Instead, let the callers of the Vector_softRemove() operation track the 'dirtyIndex' and pass it to Vector_compact() when needed. (The new 'dirtyIndex' local variables are safe to migrate from 'int' to 'size_t' because no negative value is used.) 'dirty_index' is supposed to have shorter lifespan than a Vector instance, and by removing the member we can reduce object size. 'dirty_count' is redundant and thus removed as well. A boolean 'isDirty' member is added to a Vector object for ease of debugging. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Explorer09
force-pushed
the
vector-dirty
branch
from
October 11, 2025 14:43
5e4e347 to
9367364
Compare
Explorer09
marked this pull request as ready for review
October 11, 2025 14:44
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 is a follow-up of commit 08166b2
This frees up the need of
dirty_indexanddirty_countmembers ofVectorobject. These two members are not supposed to last long and are only useful in keeping the state between thesoftRemove()andcompact()operations.Rework the two operations so that the caller would keep the
dirtyIndexwhen callingsoftRemove()and passdirtyIndexto thecompact()in the final step.The new
dirtyIndexis safe to migrate to usingsize_tas I don't use any negative value of it.