Palette kd-tree: slightly optimize getMedian#8029
Merged
Merged
Conversation
glebm
enabled auto-merge (rebase)
June 7, 2025 13:09
Our values are `uint8_t`, so we can get the median somewhat faster than `nth_element`. ``` Comparing build-reld-master/palette_blending_benchmark to build-reld/palette_blending_benchmark Benchmark Time CPU Time Old Time New CPU Old CPU New ----------------------------------------------------------------------------------------------------------------------------------- BM_GenerateBlendedLookupTable_pvalue 0.0002 0.0002 U Test, Repetitions: 10 vs 10 BM_GenerateBlendedLookupTable_mean -0.0198 -0.0198 2272848 2227790 2270291 2225348 BM_GenerateBlendedLookupTable_median -0.0199 -0.0199 2272884 2227649 2270323 2225212 BM_GenerateBlendedLookupTable_stddev +0.4575 +0.6710 536 781 396 661 BM_GenerateBlendedLookupTable_cv +0.4870 +0.7047 0 0 0 0 OVERALL_GEOMEAN -0.0198 -0.0198 0 0 0 0 ```
AJenbo
approved these changes
Jun 7, 2025
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.
Our values are
uint8_t, so we can get the median somewhat faster thannth_element.