Skip to content
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

Slow to execute over diffs with a large number of changes #27

Closed
termi opened this issue Mar 30, 2014 · 3 comments
Closed

Slow to execute over diffs with a large number of changes #27

termi opened this issue Mar 30, 2014 · 3 comments

Comments

@termi
Copy link

termi commented Mar 30, 2014

In some cases JsDiff.diffWords ate more than 500Mb RAM and I had to kill the process where it was launched

jsdiff-bug

I found this in node.js environment but it also produced in browser.

Data for reproducing this bug is here: https://gist.github.com/termi/9875658

@KiNgMaR
Copy link

KiNgMaR commented May 19, 2014

Hi @kpdecker, have you had any chance to look into this? I'm seeing the same issue with createPatch and two text files. Thanks!

@kpdecker
Copy link
Owner

Any diffing algorithm is going to take time when presented with a lot of options and particularly when those options are very different.

I was able to dramatically improve the runtime of this test case though, dropping the exec time from 18min to 2min on my local machine. The memory use also dropped from GBs to 200-300MB (All of these times are from exec within a Node environment)

There might be some remaining minor optimizations that are available, but short of changing the algorithm or diffing a smaller set of data such as lines, there aren't many alternatives for massive improvement, I fear.

@kpdecker kpdecker mentioned this issue Nov 29, 2014
@kpdecker kpdecker changed the title Infinite loop or something similar Slow to execute over diffs with a large number of changes Nov 29, 2014
@kpdecker
Copy link
Owner

Released in 1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants