ui-charts: optimize picking layer color/index conversions - #18366
Merged
Conversation
hhirtz
approved these changes
Sep 1, 2026
hhirtz
left a comment
Member
There was a problem hiding this comment.
lgtm although the former indexToColor wouldn't throw if index had an alpha component 🤷
SharglutDev
reviewed
Sep 2, 2026
SharglutDev
left a comment
Contributor
There was a problem hiding this comment.
Thank you for the PR and the perf improvements !
Yohh
approved these changes
Sep 2, 2026
Yohh
left a comment
Contributor
There was a problem hiding this comment.
thanks, glad to see a bit less of chroma
hhirtz
reviewed
Sep 2, 2026
emersion
force-pushed
the
emr/optimize-picking-color
branch
from
September 2, 2026 14:23
2bf2554 to
9cfbb70
Compare
hhirtz
approved these changes
Sep 2, 2026
Check that going through indexToColor() and colorToIndex() correctly returns the original index. Signed-off-by: Simon Ser <contact@emersion.fr>
This function cannot handle indices above 3 bytes (one byte per red, green, blue channel). Signed-off-by: Simon Ser <contact@emersion.fr>
Using chroma to convert from a hex color to RGBColor adds significant overhead. Instead, make it so indexToColor() and colorToIndex() convert directly to/from RGBColor via bit operations. This also allows us to drop COLORS_TO_INDICES and INDICES_TO_COLORS global state. Signed-off-by: Simon Ser <contact@emersion.fr>
emersion
force-pushed
the
emr/optimize-picking-color
branch
from
September 7, 2026 08:22
9cfbb70 to
10c0226
Compare
emersion
enabled auto-merge
September 7, 2026 08:22
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 7, 2026
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.
Using chroma to convert from a hex color to
RGBColoradds significant overhead. On my machine, it takes ~25% of thedrawPicking()CPU time. See this flamechart:Instead, make it so
indexToColor()andcolorToIndex()convert directly to/fromRGBColorvia bit operations.This also allows us to drop
COLORS_TO_INDICESandINDICES_TO_COLORSglobal state.(A separate, first commit also adds a guard for the maximum supported index. See its commit message for details.)