Skip to content

Refactor color(opacity:) to improve performance#155

Merged
finnvoor merged 1 commit into
finnvoor:mainfrom
alicerunsonfedora:marquis/color-dithered-performance-update
Jan 31, 2026
Merged

Refactor color(opacity:) to improve performance#155
finnvoor merged 1 commit into
finnvoor:mainfrom
alicerunsonfedora:marquis/color-dithered-performance-update

Conversation

@alicerunsonfedora

@alicerunsonfedora alicerunsonfedora commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Per my discoveries with Renzo when improving the performance of the scene renderer, I learned that I could make my Graphics.Color.dithered(by:) method faster by moving the Bayer pattern out as a constant, and initializing the UInt8 array via the literal instead of the Array(repeating:count:) initializer.

These changes are incredibly helpful if this color(opacity:) method is being called in rather hot loops where performance is critical.

Feel free to also reference what I've done in Renzo: https://source.marquiskurt.net/PDUniverse/Renzo/commit/59b0de3355b52940f18c13a696b6f332a366d08b

@alicerunsonfedora alicerunsonfedora changed the title Refactor color(opacity:) to improve performance. Refactor color(opacity:) to improve performance Jan 28, 2026
Per my discoveries with Renzo when improving the performance of the
scene renderer, I leanred that I could make my
Graphics.Color.dithered(by:) method faster by moving the Bayer pattern
out as a constant, and initialzing the UInt8 array via the literal
instead of the Array(repeating:count:) initializer.

These changes are incredibly helpful if this color(opacity:) method is
being called in rather hot loops where performance is critical.
@alicerunsonfedora alicerunsonfedora force-pushed the marquis/color-dithered-performance-update branch from 97273d2 to 63baea8 Compare January 30, 2026 22:58
@finnvoor

Copy link
Copy Markdown
Owner

looks good, thanks!

@finnvoor finnvoor merged commit edb42dd into finnvoor:main Jan 31, 2026
8 checks passed
@alicerunsonfedora alicerunsonfedora deleted the marquis/color-dithered-performance-update branch February 25, 2026 01:20
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.

2 participants