Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further environmental lighting performance improvements #4054

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented May 11, 2023

Identify the Bug or Feature request

Improves #4031

Description of the Change

The previous PR (#4042) introduced bit hacks that improved lighting performance specifically for OpenJDK 17.0.1 - 17.0.3. The current PR updates those changes so later versions are also happy to apply auto-vectorization. Also included is a cozy improvement to ConstrainedBrightenBlender that applies for all JVM versions.

Possible Drawbacks

Should be none.

Documentation Notes

N/A

Release Notes

N/A


This change is Reviewable

The main change is to unroll the loops, assigning each color component's result to a separate variable. This makes it
clear to the JVM that the operations can be vectorized. On OpenJDK 17.0.1 there is minimal difference, but later
versions would not vectorize without this change.

`ConstrainedBrightenBlender` was also modified to use a simple conditional instead of a bit shift to decide between its
two cases. The result is a consistent 30% shaved off render times.
@cwisniew cwisniew merged commit 05d252c into RPTools:release-1.13 May 11, 2023
@kwvanderlinde kwvanderlinde deleted the performance/1.13-environmental-lights--improvements branch May 11, 2023 22:47
@cwisniew cwisniew added the performance A performance or quality of life improvement label May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance A performance or quality of life improvement
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

2 participants