-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Use diff-match-patch
for text diffs
#1285
Conversation
`diff` is really slow for large strings
Thanks for submitting such an easy-win PR, love it! Obviously, I'm all for perf optimization, especially with such a little change. However, this module seems to be unmaintained. The last commit is from 2015, despite having open issues and PRs. Perhaps you are aware of some alternatives? Also, can we swap the usage of 'diff' to the other library, so that we don't have 2 dependencies that basically do the same thing? |
Ah, I chose that module as it was recommended in the issue: #1280 (comment) Didn't realise it was unmaintained, I'll have a look for some others.
Only if it supports generating a patch. The |
Well, if there are no viable and just-as-fast diff libraries out there, we can go with this one at least for string diffs, I think. It's better to use this library, than to have 20m of waiting time. |
The only other I've found is: https://github.com/liddiard/text-diff It's also pretty outdated and is just a wrapper around the same Google lib that the other project is a clone of: https://code.google.com/p/google-diff-match-patch/ |
This one doesn't have tests, so it's not a good candidate. Ok, so I see there aren't that many diff libs out there, I think we may just go with the one you used in the PR. I will test how it works and what output it provides, thank you! |
No probs 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukechilds thanks for the quick turnaround! Perhaps you could fix the merge conflict?
@novemberborn Is it not already fixed in d402277? |
Oh interesting. My merge button was set to Rebase and merge, which can't work, but I can squash and merge. |
Thanks @lukechilds! |
I like to call that squirging. No problem 👍 |
Does the google diff generate a patch? which it could be used for diff2html and produce a nice diff like git diff |
Resolves #1280
diff
is really slow for large strings. This just swaps out thediff
npm package fordiff-match-patch
which is waaaay quicker. Down from ~20mins to ~1.5s in the linked issue.