Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Dynamically allocate only required decimation_info and partition_info table space - #824

Merged
solidpixel merged 1 commit into
mainfrom
opt-bsd
Nov 30, 2026
Merged

solidpixel merged 1 commit into
mainfrom
opt-bsd

Conversation

@solidpixel

Copy link
Copy Markdown
Contributor

Current code allocates worst-case sizes for decimation_info and partition_info tables, 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.

  • 5.7 = 14.2 MB of tables.
  • 6.0 main = 5.8 MB of tables.
  • PR = 1.6 MB of tables for 6x6 -medium, 2.0 MB of tables for 6x6 -thorough.

To avoid duplicating pointer indirection, functions now accept direct references to either tables base address or the specific structure to use.

@solidpixel
solidpixel merged commit d17e6b6 into main Nov 30, 2026
20 checks passed
@solidpixel
solidpixel deleted the opt-bsd branch November 30, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant