Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
Open
Description
Feature or enhancement
Proposal:
O(n) solution is not that complex - 100 of Python lines.
I hacked in initial implementation and rancontext_diff on thedifflib.py - the change itself.
importdifflib,timewithopen('/Users/Edu/lib/src/cx_amb/src/cx/cli/snd/diff/difflib.py')asf:s1=f.read().splitlines(keepends=True)withopen('/Users/Edu/lib/src/cx_amb/src/cx/cli/snd/diff/difflib_new.py')asf:s2=f.read().splitlines(keepends=True)list(difflib.context_diff(s1,s2,fromfile='before.py',tofile='after.py'))# 2.4 ms (Current)# 2.9 ms (New)
So 30% faster.
So 20% slower.
Also, this is a fairly rough plug-in - there is a chance that the gap can be bridged.
O(n) solution should avoid some of the user dissatisfaction:
#106865
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
Made a couple of posts in unrelated thread.
Performance tables are there showing that this is faster even for sizes of 10.
https://discuss.python.org/t/include-time-and-space-complexity-in-documentation/105683/32