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

testscript: workaround quardratic behaviour of github.com/pkg/diff #137

Merged
merged 1 commit into from
Mar 29, 2021

Conversation

myitcv
Copy link
Collaborator

@myitcv myitcv commented Mar 29, 2021

The current version of github.com/pkg/diff.Diff has quadratic behaviour.
This means that when we attempt a diff between relatively modest sized
files, it's easy to find yourself out of memory.

Therefore, when we see a diff between two large files (large defined in
terms of number of lines), tersely report that as if the two were binary
files, i.e. do not try to render the diff.

When github.com/pkg/diff or similar supports a linear algorithm:

golang/go#45200 (comment)

we can revert this change.

@myitcv myitcv requested a review from mvdan March 29, 2021 12:59
testscript/cmd.go Show resolved Hide resolved
The current version of github.com/pkg/diff.Diff has quadratic behaviour.
This means that when we attempt a diff between relatively modest sized
files, it's easy to find yourself out of memory.

Therefore, when we see a diff between two large files (large defined in
terms of number of lines), tersely report that as if the two were binary
files, i.e. do not try to render the diff.

When github.com/pkg/diff or similar supports a linear algorithm:

golang/go#45200 (comment)

we can revert this change.
@myitcv myitcv force-pushed the testscript_workaround_large_diff branch from ec57b52 to 8329eeb Compare March 29, 2021 13:08
@myitcv myitcv merged commit cca5496 into master Mar 29, 2021
@myitcv myitcv deleted the testscript_workaround_large_diff branch March 29, 2021 13:14
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

Successfully merging this pull request may close these issues.

2 participants