I noticed when replaying a 1v1 with Freagarach (see below) that FindWalkAndFightTargets (attack-move) is slow, sufficiently to contribute noticeable lag with enough units.
This is a straightforward optimisation, that unfortunately changes hashes.
The idea is that most often, the first unit in rhe range query will actually pass all filters, because units have rather general preferred classes and units are the most common targets in a given area (structures are larger, thus sparser). This way, we can actually avoid filtering _and_ sorting.
Attached is profiling test on combat-demo (mid)