Refactor occupancy_t type to reduce memory allocations#296
Open
rouson wants to merge 8 commits into
Open
Conversation
This commit replaces the occupancy_t type's logical array components that were dimensioned to cover the tensor-component space for purposes of tracking each bin's occupation. The replacement component stores the component-space location of only the occupied bins.
This commit stores the number of occupied bins separately from the occupied bins list so that the list can be longer when necessary in order to reduce the number of memory allocations over the course of runs.
This commit doubles the occupied-bin list in size when adding a bin requires a longer list. Now growing the list to size N, requires only log_2(N) memory allocations instead of N allocations.
rouson
force-pushed
the
refactor-occupancy_t
branch
from
July 18, 2026 08:22
efe7de1 to
22097e3
Compare
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
occupancey_ttype in order to support refactoring itoccupancy_ttype to store the number of occupied bins separately from the occupied-bins array so the array can be longer than the number of occupied bins when necessaryNow the occupied-bin array doubles in size whenever the addition of a new bin requires a longer list. This implies that growing the list to size N requires only$$log_2(N)$$ memory allocations instead of N allocations.