You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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. As noted by @rogalski#205, on each iteration of the loop in which AST verification fails,
we'll call parse_ast for src repetitively, even though for single file reformatted in darker passed value will never change
Parsing the non-changing source file repeatedly is of course redundant. We could get rid of redundant calls and improve performance e.g. by
making the stringify_ast(parse_ast(src_ast)) call just once directly from Darker,
calling stringify_ast(parse_ast(dst_ast)) in Darker's bisection loop, and
comparing the results in the loop in order to detect whether the AST is intact.
While doing that, we could also get rid of unnecessary debug dumps which also harm performance (see #211 [closed by merged #214]).
The downside of re-implementing AST verification in Darker is that we wouldn't automatically benefit from any possible future refinements in Black to that code.
The text was updated successfully, but these errors were encountered:
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. As noted by @rogalski #205, on each iteration of the loop in which AST verification fails,
Parsing the non-changing source file repeatedly is of course redundant. We could get rid of redundant calls and improve performance e.g. by
stringify_ast(parse_ast(src_ast))
call just once directly from Darker,stringify_ast(parse_ast(dst_ast))
in Darker's bisection loop, andWhile doing that, we could also get rid of unnecessary debug dumps which also harm performance (see #211 [closed by merged #214]).
The downside of re-implementing AST verification in Darker is that we wouldn't automatically benefit from any possible future refinements in Black to that code.
The text was updated successfully, but these errors were encountered: