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

lcs only performed on small sequences, resulting in large diffs for larger sequences #21

Open
orph opened this issue Jul 16, 2017 · 2 comments

Comments

@orph
Copy link

orph commented Jul 16, 2017

this line: https://github.com/intelie/immutable-js-diff/blob/master/src/diff.js#L67 performs a mapdiff if the input sequences are >99 long, which results in a large element-by-element diff. this is very unexpected and was hard to track down.

@orph orph changed the title lcs on performed on small sequences, resulting in large diffs for larger sequences lcs only performed on small sequences, resulting in large diffs for larger sequences Jul 16, 2017
@pedroteixeira
Copy link
Contributor

The rationale was that patches would be equivalent, and the actual implementation wanted to avoid high cpu usage for large sequences, so the tradeoffs was between diff size and computational complexity.

but you're right, it's pretty arbitrary :/

not sure if we should remove this behaviour and make it configurable somehow. Any suggestions?
for your case for eg., a higher number would be better?

@orph
Copy link
Author

orph commented Jul 18, 2017

the problem is that the patches are not equivalent - inserting an element causes many more operations with mapDiff. It's stepping through each pair following the inserted index, finding them different, and diffing all the individual fields. Versus with sequenceDiff it would be a single 'add' operation.

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

2 participants