cubing / twsearch

🔍 Twizzle Search — a program to find algs and scrambles for twisty puzzles
GNU General Public License v3.0
24 stars 8 forks source link

Try a dynamically sized array for `orientation_packer`. #33

Open lgarron opened 10 months ago

lgarron commented 10 months ago

Per:

https://github.com/cubing/twsearch/blob/c01a33da913e2c29a8168670bdef0798bdde4eb3/src/rs/packed/orientation_packer.rs#L7-L13

// TODO: Avoid using this to hardcode the outer size of transformation_lookup. // Setting MAX_NUM_ORIENTATIONS is usually way larger than necessary, although // the wasted space is only ≈25KB per orbit. Ideally, we should allow // transformation_lookup to be much smaller by using another direct allocation // (without taking the performance hit of Vec, which is noticeable in this // situation).

Using Vec<[PackedOrientationWithMod; NUM_BYTE_VALUES]> for transformation_lookup has a noticeable negative impact on performance, so that's not a good option. (This was changed in fe3a8599b071952af2c4a44cfc26913a472c103f.)

We already use a pointer-based u8 array for PackedKState, so we could possibly adapt that.

lgarron commented 10 months ago

Using Vec<[PackedOrientationWithMod; NUM_BYTE_VALUES]> for transformation_lookup has a noticeable negative impact on performance, so that's not a good option. (This was changed in fe3a859.)

Actually, this might not be true! I'm running benchmarks again and it might be within normal variability.

Still worth trying, since it wouldn't take that long to experiment.