Miscellaneous data loading optimizations #1438
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements several optimizations with the goal of reducing loading times (especially in worst-case scenarios) and reduce data usage when possible:
Link
header.Since we requested the API to return 1 member per page, the number of pages will be equal to the number of members (except when there are 0 or 1 members in an org, but I made sure to handle that case as well).
ApiHelpers.PageIterator
), set the number of results per page to 100 instead of using the default (which is 30).This gives a fairly big performance improvement when paginated lists have several hundreds of items. Below are some examples of such worst-case scenarios:
torvalds/linux
repo)It's important to note that performance gains are much less prominent for paginated lists that have less items in total (<100). For example, a PR conversation that previously took 6,5 secs to load now takes ~5 secs in my testing.
One last thing worth mentioning: updating OkHttp to version 4 was required to make AS network inspector work properly, since it doesn't support OkHttp 3.x anymore. Breaking changes in 4.x do not affect us and the bindings were updated to support OkHttp 4 quite some time ago 🙂