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

Slowdown in the case of incorrect hunks values #17

Closed
sv-91 opened this issue Jul 29, 2022 · 1 comment
Closed

Slowdown in the case of incorrect hunks values #17

sv-91 opened this issue Jul 29, 2022 · 1 comment

Comments

@sv-91
Copy link

sv-91 commented Jul 29, 2022

    let patch = "\
@@ -10,6 +1000000,8 @@
 First:
     Life before death,
     strength before weakness,
     journey before destination.
 Second:
-    I will put the law before all else.
+    I swear to seek justice,
+    to let it guide me,
+    until I find a more perfect Ideal.
";

    let original = "\
First:
    Life before death,
    strength before weakness,
    journey before destination.
Second:
    I will put the law before all else.
";

    let patch = Patch::from_str(patch).unwrap();
    let result = apply(original, &patch);

This code works very slovely because of incorrect value 1000000 of patch

@bmwill bmwill closed this as completed in 7579560 Jul 29, 2022
@bmwill
Copy link
Owner

bmwill commented Jul 29, 2022

Thanks for the bug report and the repro case! I was able to reproduce the slowdown locally and I believe I was able to fix the issue. On my machine this test case went from 200ms to 30us (in debug mode) with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants