Skip to content

Better implementation for getItemCount on FlatList#26164

Closed
ifsnow wants to merge 1 commit into
facebook:masterfrom
ifsnow:fix/improve-getitemcount-flatlist
Closed

Better implementation for getItemCount on FlatList#26164
ifsnow wants to merge 1 commit into
facebook:masterfrom
ifsnow:fix/improve-getitemcount-flatlist

Conversation

@ifsnow
Copy link
Copy Markdown
Contributor

@ifsnow ifsnow commented Aug 23, 2019

Summary

Flatlist's getItemCount function is frequently called internally by VirtualizedList.
As with other functions, we can remove unnecessary operations with the numColumns value.
This makes it much more efficient.

Changelog

[Internal] [Changed] - Better implementation for getItemCount on FlatList

Test Plan

Not required

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 23, 2019
Copy link
Copy Markdown
Contributor

@sahrens sahrens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - definitely nice to avoid the division in the common case with numColumns == 1 in such a hot path!

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sahrens is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @ifsnow in bb05176.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Component: FlatList Merged This PR has been merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants