Skip to content

Optimize collision frames#6

Open
lucaswerkmeister wants to merge 1 commit into
kirklong:masterfrom
lucaswerkmeister:collision
Open

Optimize collision frames#6
lucaswerkmeister wants to merge 1 commit into
kirklong:masterfrom
lucaswerkmeister:collision

Conversation

@lucaswerkmeister
Copy link
Copy Markdown
Contributor

The freeze-frame at the end of a collision consists of 45 identical frames that don’t depend on the loop variable (i). There’s no need to calculate the same frame 45 times – just calculate it once and then write it 45 times.


Note that, while the last 45 PNGs look identical to me, they’re not identical files (different checksums). I don’t know enough about the PNG format to judge why that is. Also, this seems to result in no wall-clock speedup – I ran two simulations reproducing this post, with and without this optimizations, and in both cases the freeze-frame took 60 seconds (timed manually, so plus or minus one or two seconds to account for my reaction time and stuff). I guess writing the PNGs is more expensive than generating them? 🤷

Anyway, feel free to either merge or close this :)

The freeze-frame at the end of a collision consists of 45 identical
frames that don’t depend on the loop variable (i). There’s no need to
calculate the same frame 45 times – just calculate it once and then
write it 45 times.
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.

1 participant