Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering out of scope pull request hunks search optimization O(n log m) vs O (m + n) #87

Closed
TomKristie opened this issue Aug 20, 2020 · 1 comment
Assignees
Labels
type: cleanup An internal cleanup or hygiene concern.

Comments

@TomKristie
Copy link
Contributor

TomKristie commented Aug 20, 2020

In-line PR comment suggesting:

If the create comment GitHub API specifies lines that are outside of the scope, the API returns an error. Therefore we do a preemptive filtration of suggestion hunks by removing hunks that are outside of the PR scope. Specifically, we have lists of hunk ranges for each file that we want to suggest, and several ranges for each file that is in scope for the PR, and return only the in-hunk-scope suggestions for each in-scope file.

let m be the total PR hunk scope
let n be the total suggestion hunks

Currently we assume that the PR total hunk scopes and the total suggestion hunks would vary. We also assume to encounter more cases where m >> n. And so the algorithm's current runtime is O(n log m)

We assume that if n > m or n == m on average, that the user should probably have a PR just dedicated to these changes, or a better system in place (if systematically there are a lot of suggestions to be made). i.e. the bulk of the PR changes should not be from the suggestion tool.

It may become ideal to test the performance threshold of n and mm for when O(n log m) becomes more advantage than O(n + m). From this test we can then in an if statement control which algorithm to use.

https://stackoverflow.com/questions/37418916/on-log-m-vs-onm-which-is-better

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Aug 21, 2020
@JustinBeckwith JustinBeckwith added type: cleanup An internal cleanup or hygiene concern. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Aug 26, 2020
@chingor13
Copy link
Contributor

#132 switched to O(n + m)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

4 participants