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.
The first patch was reverted as it was breaking up ingestion (certainly due to timeout because some pushes could be linked to thousands of commits).
I restored the limit of prefetched commits to 20, using a subquery. This was relatively easy to implement with django's ORM, but is not supported by MySQL:
The last alternative would be to perform the prefetch separately, then annotate the Push objects manually but this would be more of a hack.
Performances improvements still seems to be pretty good (if not even better):
Small data (
/api/project/autoland/push/?full=true&count=100&fromchange=<rev_id>
)master
: 779 ms ± 63.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)7ad83d87
: 688 ms ± 6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)Large data (
/api/project/autoland/push/?full=true&count=100
)master
: 7.64 s ± 97.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)7ad83d87
: 2.06 s ± 33 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)