Algorithmic complexity of difflib

No worries at all.
And hope things sort out in the best possible way for you.

I will be brief then.


Good news.

I think theoretical worst case complexity is O(n sqrt(n)) now. It is likely that

a-aa-aaa-aaaa-aaaaa-...
a+aa+aaa+aaaa+aaaaa+...

is the worst that can be done.
And 100K of this runs in 6 seconds.

That wasn’t clear at all…

All I meant is to allow string selection for convenience:

difflib.Differ(..., linematcher='exact')
1 Like