Repository navigation
Dynamically allocate only required decimation_info and partition_info table space - #824
Merged
Merged
Conversation
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.
Current code allocates worst-case sizes for
decimation_infoandpartition_infotables, but for nearly all configs this is pessimistic and allocates much more memory than we actually need because not all of those entries are actually used.Many decimation modes are unusable for a given block size, and many partitioning seeds result in a duplicate partition or a degenerate encoding with fewer than the desired number of partitions. A specific compressor quality preset will then reduce this further by only selecting a subset of block modes (and their corresponding decimation modes) to search.
This PR makes decimation and partition tables dynamically allocated, using a two pass construction which determines how many to allocate and then populates them. This duplicates some work on context init, but gives significant memory savings and a small performance boost due to better locality.
To avoid duplicating pointer indirection, functions now accept direct references to either tables base address or the specific structure to use.