Skip to content

Commit

Permalink
optimize MOV finding a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
girst committed Jan 4, 2021
1 parent 313ac51 commit f744588
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mopidy_spotify/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ def diff(old, new, chunksize=100):
ops.append(op("-", old[i1:i2], i1))

# then, merge pairs of insertions and deletions into a transposition:
# for this, we start from the rightmost element,
# for this, we start from the rightmost element and ...
for R in reversed(range(len(ops))):
# and compare against all elements on its left
# ..., unless we already worked on this element, ...
if ops[R].op == 'm':
continue
# ... compare against all elements on its left
for L in reversed(range(R)):
# if we found a pair of ins/del that can be combined,
if _is_move(ops[R], ops[L]) or _is_move(ops[L], ops[R]):
Expand Down

0 comments on commit f744588

Please sign in to comment.