-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: New movement implementation #123
base: main
Are you sure you want to change the base?
Conversation
6af5f61
to
be3365b
Compare
It's also pretty inefficient when generating the longest common sequence as we constantly reallocate results, and we should be reusing that array (after preallocation). |
Added an optimization pass: To simplify the move actions generation, algorithm doesn't check if any previous move made current one reduntant. So for some sequences it can generate extra movements. |
e101de5
to
ac2d065
Compare
af40eaf
to
ec333c0
Compare
16d11ac
to
5d871cf
Compare
c289227
to
9d1aa90
Compare
9d1aa90
to
a93af33
Compare
d61ac46
to
10b22cc
Compare
This new algorithm implements generation of move actions by utilizing a longest common substring algorithm (LCS). First, based on the position type, we generate a list describing the expected order of the elements. LCS algorithm is then used to find the longest sequence of items that is shared between the expected list, and an actual list (e.g. a list of entries from the server). Once longest sequence is known, we figure out the least amount of moves to translate existing list into its expected form, and those movements are returned back.
Fixed some bugs in LCS implementation, but it needs to be be optimized - it takes ~25 seconds to find a common subsequence in two equal sequences of 50k elements. Added an OptimizeMovements step that is done after GenerateMovements returns a list of all move actions. It removes redundant actions that, after previous actions were applied, no longer have any effect.
…tion Now GenerateMovements() generate all movements blindly, and depend on the optimization done by OptimizeMovements() to remove reduntant actions.
a93af33
to
2fdaa61
Compare
Description
This new algorithm implements generation of move actions by calculating steps between existing and expected sequences: