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

Switch to Myers diff #982

Merged
merged 5 commits into from
Feb 11, 2023
Merged

Switch to Myers diff #982

merged 5 commits into from
Feb 11, 2023

Conversation

SuperAuguste
Copy link
Member

@SuperAuguste SuperAuguste commented Feb 7, 2023

Fixes #979;

I originally ripped off gopls' Myers Difference Algorithm implementation, but realized that it did not fit our usecase, so I instead wrote about 2000 lines of code for a Zig DiffMatchPatch impl w/ Travis, which is what this PR uses! :)

Confirmed working by adding a new, correct diff patch implementation (which we should probably start using in the future) to diff.zig and getting tests running.

@SuperAuguste
Copy link
Member Author

SuperAuguste commented Feb 7, 2023

Extremely weird CI failure... (Compiler issue?)

@llogick
Copy link
Contributor

llogick commented Feb 7, 2023

Extremely weird CI failure... (Compiler issue?)

Weird.
0.11.0-dev.1570+693b12f8e

LLVM Emit Object... invalid type ref
!163020 = !DILocalVariable(name: "v_m", scope: !163021, file: !4047, line: 179, type: zig2: /home/workaccount/Work/llvm-project-15/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = llvm::ValueAsMetadata, From = const llvm::Metadata]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

@SuperAuguste SuperAuguste marked this pull request as ready for review February 7, 2023 22:41
@SuperAuguste SuperAuguste added the pr:fuzz Attach to a PR to start fuzzing / continually fuzz (please do this before merging!) label Feb 7, 2023
@SuperAuguste
Copy link
Member Author

SuperAuguste commented Feb 8, 2023

Sadly, while this drastically improves performance, this messes up the cursor position on format by moving it to the start of the line. Looking for a solution / better algorithm we could use :)

Solution found: implementing diffmatchpatch in its entirety, in Zig, live on stream :P

See the repo

@SuperAuguste SuperAuguste merged commit bf19ed3 into master Feb 11, 2023
@SuperAuguste SuperAuguste deleted the optimize-diff branch February 11, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fuzz Attach to a PR to start fuzzing / continually fuzz (please do this before merging!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

formatting file with zls causes infinite loop in memory allocator
3 participants