Skip to content

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

Merged
myitcv merged 1 commit intomasterfrom
testscript_workaround_large_diff
Mar 29, 2021
Merged

testscript: workaround quardratic behaviour of github.com/pkg/diff#137
myitcv merged 1 commit intomasterfrom
testscript_workaround_large_diff

Conversation

@myitcv
Copy link
Copy Markdown
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
Comment thread testscript/cmd.go
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