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

Precompute light propagation data at build time instead of in Space initialization. #492

Merged
merged 1 commit into from
May 12, 2024

Conversation

kpreid
Copy link
Owner

@kpreid kpreid commented May 12, 2024

Instead of making a chart for the exact right size, we make the biggest one we can, then do a distance check while iterating. This avoids redundant run-time work and, in particular, should make the tests we run under Miri that happen to allocate Spaces much faster.

Size of the data is a concern; it's currently 645 KB. In the future, I plan to replace this data structure with one which combines nearly-parallel rays that traverse the same cubes, until they diverge, instead of redundantly storing and iterating over each ray's sequence of cubes. That will allow more rays for the same data and compute costs.

One unused possibility for further compression is storing only the face/step directions instead of both the faces and the cube coordinates.

Part of #490

@kpreid kpreid added kind: performance Ways to increase performance or efficiency without adding functionality area: simulation Things related to what can happen in the world as time progresses. labels May 12, 2024
… initialization.

Instead of making a chart for the exact right size, we make the biggest
one we can, then do a distance check while iterating. This avoids
redundant run-time work and, in particular, should make the tests we
run under Miri that happen to allocate `Space`s much faster.

Size of the data is a concern; it's currently 645 KB. In the future, I
plan to replace this data structure with one which combines
nearly-parallel rays that traverse the same cubes, until they diverge,
instead of redundantly storing and iterating over each ray's sequence of
cubes. That will allow more rays for the same data and compute costs.

One unused possibility for further compression is storing *only* the
face/step directions instead of both the faces and the cube coordinates.
@kpreid kpreid merged commit 7b2c163 into main May 12, 2024
14 checks passed
@kpreid kpreid deleted the light2 branch May 16, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: simulation Things related to what can happen in the world as time progresses. kind: performance Ways to increase performance or efficiency without adding functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant