Skip to content

Conversation

@andyfinnell
Copy link
Collaborator

Summary

For collection views, we do not currently check for batch fetching on scroll. This appears to be a bug, as scrollViewDidScroll: does call _checkForBatchFetching, and the commit that added it states it's trying to check on each scroll. Unfortunately, _checkForBatchFetching checks for isTracking and isDragging first and returns if either are YES. Since we're in a scroll, they are YES. So the call is effectively a no-op.

This bug has been around for 9 years and I'm unsure of the performance implications of turning the batch fetching check on for each scroll tick. Therefore, put the fix behind an experiment feature flag and only call it on the first scroll tick for the scroll session, instead of every scroll tick. Finally, I moved the check after the delegate call, in case the delegate has logic in it to turn on or off the batch fetching.

Test plan

Ran the app and manually tested batching getting called or not. Also ran build.sh tests.

## Summary

For collection views, we do not currently check for batch fetching on scroll. This appears to be a bug, as `scrollViewDidScroll:` does call `_checkForBatchFetching`, and [the commit that added it states it's trying to check on each scroll](TextureGroup@df497b8). Unfortunately, `_checkForBatchFetching` checks for `isTracking` and `isDragging` first and returns if either are `YES`. Since we're in a scroll, they are `YES`. So the call is effectively a no-op.

This bug has been around for 9 years and I'm unsure of the performance implications of turning the batch fetching check on for each scroll tick. Therefore, put the fix behind an experiment feature flag _and_ only call it on the first scroll tick for the scroll session, instead of every scroll tick. Finally, I moved the check after the delegate call, in case the delegate has logic in it to turn on or off the batch fetching.

## Test plan

Ran the app and manually tested batching getting called or not. Also ran `build.sh tests`.
@andyfinnell andyfinnell merged commit be0b74b into TextureGroup:master May 22, 2025
11 checks passed
@andyfinnell andyfinnell deleted the feature/check-for-batch-fetching-on-scroll branch May 22, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants