cashapp / AccessibilitySnapshot

Easy regression testing for iOS accessibility
Apache License 2.0
534 stars 65 forks source link

Improve hit test performance by optimizing Y axis #177

Closed NickEntin closed 5 months ago

NickEntin commented 6 months ago

This is the first performance optimization for hit test snapshotting, focused on optimizing the Y axis.

Note this optimization introduces a possibility of missing a hit region, specifically in the case where there's a very thin horizontal hit region (for example, a hairline separator view) with the same hit target view on both sides. I think given the huge performance improvement, this is probably acceptable in most cases, but I made it configurable so it's up to consumers to make that trade-off.

Split into three commits:

  1. A pure refactor to make it clearer what the performance optimization does.
  2. Introduces the performance optimization.
  3. Makes the performance optimization configurable.