-
Notifications
You must be signed in to change notification settings - Fork 5
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
Introduce Myers algorithm in linear space #112
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
============================================
+ Coverage 84.26% 86.07% +1.80%
- Complexity 151 221 +70
============================================
Files 22 30 +8
Lines 534 632 +98
Branches 89 117 +28
============================================
+ Hits 450 544 +94
- Misses 57 59 +2
- Partials 27 29 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Required to correctly host the new code.
This fixes a long-standing bug, where we did not copy the list, but merely return of view of it.
This replaces the untyped lambda.
testPerformanceProblemsIssue124 showed a 30s vs 7s runtime. Moving to fields instead of getters drastically improved performance down to 10s. Still, not optimal.
45d28ee
to
f3d1caf
Compare
val origList = inlineDiffSplitter.split(joinedOrig) | ||
val revList = inlineDiffSplitter.split(joinedRev) | ||
|
||
// Copying of `origList` and `revList` is needed because otherwise `wrapInTag` results in ConcurrentModificationException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petertrr I don't understand why this would throw a ConcurrentModificationException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure TBH; this part was copied from the original library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petertrr no problem, I can remove it, it's not needed as we aren't operating on the lists concurrently.
I'm done with this one. The refactor: clean up DiffRowGenerator commit has a bit of changes but they're mostly to remove "untyped" lambdas. This PR is a breaking API change for |
.DS_Store | ||
.kotlin/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kotlin 2.0 introduces a new folder to store metadata.
|
||
- fuzzy patches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will port in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for disappearing. Your PR generally LGTM, I have just a couple of questions. Also, what's the breaking change in the DiffRowGenerator
? Is it a new constructor parameter, or did I overlook something else?
@@ -19,11 +19,12 @@ | |||
package io.github.petertrr.diffutils.algorithm | |||
|
|||
import io.github.petertrr.diffutils.patch.DeltaType | |||
import kotlin.jvm.JvmField | |||
|
|||
public data class Change( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if making the class @JvmRecord
instead would have similar effect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petertrr we are targeting Java 8, so it wouldn't make any difference unfortunately.
But anyway, with records the only difference is method naming, e.g. getX()
> x()
, so you'd still not expose fields directly.
|
||
while (i < end1 || j < end2) { | ||
if (i < end1 && j < end2 && equalizer.test(data.source[i], data.target[j])) { | ||
// script.append(new KeepCommand<>(left.charAt(i))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan for the commented code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petertrr I'll get rid of them!
val origList = inlineDiffSplitter.split(joinedOrig) | ||
val revList = inlineDiffSplitter.split(joinedRev) | ||
|
||
// Copying of `origList` and `revList` is needed because otherwise `wrapInTag` results in ConcurrentModificationException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure TBH; this part was copied from the original library.
It's just the constructor, we introduced new interfaces so I'm not sure it would work straight away. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for a nice improvement!
@petertrr np. I have another PR with a small cleanup and then it would be cool to do a release imo! |
Ah I see you already released ahaha, well no problem, will be for another minor release. |
This PR requires #111 to be merged first.
I will then rebase.