diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-08-06 13:30:38 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-08-06 13:30:38 +0100 |
| commit | 6d4b20c413811a9f88e5be97128b7dd6445bff08 (patch) | |
| tree | a1cd3bc39792e54e937b3424ea83b7592fcb37ef /pattern.c | |
| parent | ff860360c3eb6b146674384a15d10fde788bd545 (diff) | |
| download | puzzles-6d4b20c413811a9f88e5be97128b7dd6445bff08.zip puzzles-6d4b20c413811a9f88e5be97128b7dd6445bff08.tar.gz puzzles-6d4b20c413811a9f88e5be97128b7dd6445bff08.tar.bz2 puzzles-6d4b20c413811a9f88e5be97128b7dd6445bff08.tar.xz | |
Pearl: re-use a single grid structure when generating
Pearl generally has to generate quite a lot of candidate loops before
it can find one that makes a viable puzzle. Before this change it
generated a new grid structure for each of those candidate loops. The
result was that grid_new() accounted for over 5% of the
puzzle-generation time.
Pulling grid_new() out of the loop-generation loop makes "pearl
--generate 100 8x8dt#0" about 6% faster on my laptop, while producing
precisely the same output. Most of this change is just renaming the
"grid" variable in new_clues() so it doesn't collide with the typedef
of the same name.
Diffstat (limited to 'pattern.c')
0 files changed, 0 insertions, 0 deletions