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

Add timeout? #398

Closed
hyrious opened this issue Apr 14, 2023 · 2 comments · Fixed by #478
Closed

Add timeout? #398

hyrious opened this issue Apr 14, 2023 · 2 comments · Fixed by #478

Comments

@hyrious
Copy link

hyrious commented Apr 14, 2023

Can we add an option like diff_match_path.Diff_Timeout in sync mode? Since #396 may not be solved easily, this option can help reducing many issues about performance like #376

@quark-zju
Copy link

FWIW, diff_match_path.Diff_Timeout does not seem to actually work in its Javascript version. Whatever value it is set, the dmp diff algorithm takes the same time. And if the timeout is too small, the diff output is suboptimal (the computation for the more optimal diff is done but dropped due to the timeout logic). So in practice you always want to set it to a large value to avoid discarding the optimal diff output.

@ExplodingCabbage
Copy link
Collaborator

Not directly relevant to jsdiff, but for the record, I see different behaviour with diff_match_patch to what you describe, @quark-zju. I tried diffing two random million-line strings against each other with differing Diff_Timeout values and the Diff_Timeout clearly had an effect; when set to 1, execution finished after about 1 second, when set to 10, after about 10 seconds.

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

Successfully merging a pull request may close this issue.

3 participants