- Notifications
You must be signed in to change notification settings - Fork82
-
I'm currently searching for a fast algorithm to diff large arrays. Just one level, values can be compared with importdifffrom"microdiff";// Build source array with values 0..9999consta:number[]=[];for(leti=0;i<10000;i++){a.push(i);}// Clone source array into target array and just add one number at the beginningconstb=a.slice();b.unshift(-1);console.log(diff(a,b)); I expected a diff with a CREATE change for index 0 but instead I get a diff with 10000 changes. When I add the number at the end then I get a single CREATE change as expected but when inserting or removing a single value somewhere then all subsequent entries are reported as CHANGED. Is this intended? Am I doing something wrong? I don't expect the shortest possible diff (which I know is expensive to generate) but this result seems pretty much useless. |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 0 comments
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment