sdleffler / collapse

A reimplementation/(pending) improvement on the wavefunction collapse texture synthesis algorithm.
MIT License
132 stars 8 forks source link

Significantly slower than the reference implementation #2

Open johnpmayer opened 5 years ago

johnpmayer commented 5 years ago

I ran this on both windows as well as ubuntu linux subsystem on windows. I am going to try this on mac as well.

When generating a 50x150 output image (using 3x3 sampling) from an approximately 50x50 source, with "level 3 symmetry", the reference C# implementation generates 2 images in under a minute, while the rust implementation

I'm opening this issue primarily to document my experience, I intend to continue by profiling my workload and diagnose the cause of the slowness.

sdleffler commented 5 years ago

Hi! I appreciate the information. I wrote this project partially to learn Rust, back when I wasn't as familiar with the language. There are a number of things which could be causes for this. To start with, it wasn't written for speed, although I recall making a number of optimizations over the original which should make it somewhat faster than the original, at least at the time of writing. I mostly intended it to be clear, as the original was written somewhat inscrutably. This goal seems to be somewhat hampered by a lack of comments. Oops.

I'm guessing you're already doing this, but just in case, please ensure you are compiling the project with --release enabled. Even small amounts of optimization can do drastic things to Rust performance.

Otherwise, I'll have to wait until I see all the information.