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

Change the algorithm of comparison #95

Closed
eGavr opened this issue Sep 10, 2014 · 8 comments
Closed

Change the algorithm of comparison #95

eGavr opened this issue Sep 10, 2014 · 8 comments

Comments

@eGavr
Copy link
Member

eGavr commented Sep 10, 2014

@phrazer proposed the following:

I had another idea, what if we first check line by line, and then if lines are the same go on, if not we also check word by word that line. Maybe then you get best from both worlds - speed and great diff tool. Just an idea, dont know if its possible to make it.

@eGavr eGavr changed the title Differ enhancement Change the algorithm of comparison Sep 10, 2014
@eGavr eGavr mentioned this issue Sep 10, 2014
@eGavr
Copy link
Member Author

eGavr commented Sep 11, 2014

It seems can't be implemented. Consider the following situation:

<span class="a
    b"></span>

and

<span class="a b"></span>

How can we compare them line by line?

@eGavr
Copy link
Member Author

eGavr commented Sep 11, 2014

// cc @phrazer

@phrazer
Copy link

phrazer commented Sep 11, 2014

I will think about it, and get back to you...

We can make switch to enable this only on big files, so smaller ones stays the same. Then we could first process both htmls with tidy -w 1000 option (it makes html 100% correct and gets every tag in separate line) and eliminate this problem. Then you just make line by line, then word by word, like we said on the beggining.

@phrazer
Copy link

phrazer commented Sep 11, 2014

I used tidy on a lot of projects and it is really fast and never had problems with it... Its stable, been around long time.

@eGavr
Copy link
Member Author

eGavr commented Sep 11, 2014

tidy is a nodejs module? Give me a link, please?

@eGavr
Copy link
Member Author

eGavr commented Sep 11, 2014

I can not understand, why do you need differ in tasks when you can find diffs without any tools?
I tried to implement the idea of comparison by lines, but there are still so many diffs that jsdiff fails.

@phrazer
Copy link

phrazer commented Sep 11, 2014

@eGavr
Copy link
Member Author

eGavr commented Sep 11, 2014

The problem discussed in #94

@eGavr eGavr closed this as completed Sep 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants