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

Loop invariant code slows down bisection when AST verification fails #210

Closed
akaihola opened this issue Sep 30, 2021 · 0 comments · Fixed by #209
Closed

Loop invariant code slows down bisection when AST verification fails #210

akaihola opened this issue Sep 30, 2021 · 0 comments · Fixed by #209
Labels
performance Speed or memory usage improvement
Milestone

Comments

@akaihola
Copy link
Owner

As noted by @rogalski in #205,

run_black, diff_and_get_opcodes and opcodes_to_chunks are run in each pass of bisect loop, despite being independent from context_lines variable:

formatted = run_black(rev2_isorted, black_config)
opcodes = diff_and_get_opcodes(rev2_isorted, formatted)
black_chunks = list(opcodes_to_chunks(opcodes, rev2_isorted, formatted))

These lines should be moved to be executed before the loop.

If AST verification fails, Darker starts to bisect in order to find the smallest possible number of extra diff context lines which preserves the AST. Moving loop invariant code outside the bisection loop will speed up this process.

@akaihola akaihola added the performance Speed or memory usage improvement label Sep 30, 2021
@akaihola akaihola added this to the 1.4.0 milestone Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Speed or memory usage improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant