Optimization in Games
Memory usage optimizations for big puzzles.
1. Cleanup the unprocessed piece images after having finished loading.
2. Restrict the shadow radius to 50px maximum.
With a big test puzzle (4000x4000, 300 pieces), memory usage (for the
whole process) drops from 780 MB to 370 MB.
Optimization 1 makes 100 MB (= one set of uncompressed piece images),
optimization 2 fress about 300 MB (because the shadow size decreases
from about 300px to the new limit of 50px).
Note that loading time has not been affected by this. It's still
awfully slow if you have the visual effects enabled.