question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

implement Meyers diffing algorithm

See original GitHub issue

So we have a slight diffing problem — not only are we fairly slow at updating, reordering nodes is also suboptimal. This means that some reorders can be surprising at the worst case, and in a worst case reorders simply take longer than they should.

In computer science this is known as “diffing”, and is a rather well-studied problem. Probably the best known algo for this is the Mayers Diffing algorithm. It’d be neat if we could make use of this for nanomorph.

references

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:31 (17 by maintainers)

github_iconTop GitHub Comments

6reactions
tunnckoCorecommented, Feb 2, 2018

Heya! 🎉 Following this long time. And as i once mentioned, i once wanted to rewrite it from scratch - for learning, playing and minimizing the size. So code name was “minmorph” - removed the “./events” list, the remaining is almost the same with few optimizations. Actually not sure why we need to list all the events?

Long story short, back then i tested it against nanomorph’s tests and only 1 tests was failing. Recently was touching it more and following the need for benchmarking, i got the @graforlock repo and put it there so we can benchmark. Also added the nanomorphs tests.

And so, the result is all of the normal tests are passing and only 8 of the “keyed” tests are failing! The benchmark results are phenomenal 😃 I’m going to create a clean repo with everything, plus @graforlock’s code and benchmark. Then i’ll PR the implementation so we can discuss and continue on fixing these 8 tests, because i’m not so familiar with the keyed things 😄

The tests are green (almost) 2018-02-02-02 34 40_1280x1024_scrot

minmorph benchmark - numbers are the same as the @graforlock’s not finished code, which in turn fails pretty much tests. 2018-02-02-02 35 04_1280x1024_scrot

Nanomorph benchmark 2018-02-02-02 34 53_1280x1024_scrot

4reactions
yoshuawuytscommented, Jan 16, 2019

@brucou hey! – I’ve casually started working on a WASM version, but there’s no ETA when this might be done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Myers diff algorithm: part 1 - The If Works
The idea behind the Myers algorithm is quite simple: we want to get from (0,0) to (7,6) (the bottom-right) in as few moves...
Read more >
Myers Diff Algorithm - Code & Interactive Visualization - Blog
Step 8) Improving Myers' Algorithm: Circular V Array · Step 1) Form A Grid Using The Two Strings · Step 2) Diagonals Denote...
Read more >
An implementation of the Myers diff algorithm · GitHub
An implementation of the Myers diff algorithm. GitHub Gist: instantly share code, notes, and snippets.
Read more >
The Myers Difference Algorithm - Nathaniel W. - Wroblewski
His algorithm improved the popular diff utility, a data comparison tool that displays the smallest set of line-by-line deletions and insertions to transform...
Read more >
Myers' Diff Algorithm : The basic greedy algorithm
The algorithm is iterative. It calculates the furthest reaching paths on each k line for successive d . A solution is found when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found