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

Avoid diffing by lines if inefficient #260

Merged
merged 1 commit into from May 25, 2021
Merged

Avoid diffing by lines if inefficient #260

merged 1 commit into from May 25, 2021

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Apr 30, 2021

Avoid diffing by lines if it turns out to be significantly less
efficient than diffing by bytes.

Before this change:

  (
  	"""
- 	d5c14bdf6bac81c27afc5429500ed750
- 	25483503b557c606dad4f144d27ae10b
- 	90bdbcdbb6ea7156068e3dcfb7459244
- 	978f480a6e3cced51e297fbff9a506b7
+ 	Xd5c14bdf6bac81c27afc5429500ed750
+ 	X25483503b557c606dad4f144d27ae10b
+ 	X90bdbcdbb6ea7156068e3dcfb7459244
+ 	X978f480a6e3cced51e297fbff9a506b7
  	"""
  )

After this change:

  strings.Join({
+ 	"X",
  	"d5c14bdf6bac81c27afc5429500ed750\n",
+ 	"X",
  	"25483503b557c606dad4f144d27ae10b\n",
+ 	"X",
  	"90bdbcdbb6ea7156068e3dcfb7459244\n",
+ 	"X",
  	"978f480a6e3cced51e297fbff9a506b7\n",
  }, "")

Avoid diffing by lines if it turns out to be significantly less
efficient than diffing by bytes.

Before this change:
    (
    	"""
  - 	d5c14bdf6bac81c27afc5429500ed750
  - 	25483503b557c606dad4f144d27ae10b
  - 	90bdbcdbb6ea7156068e3dcfb7459244
  - 	978f480a6e3cced51e297fbff9a506b7
  + 	Xd5c14bdf6bac81c27afc5429500ed750
  + 	X25483503b557c606dad4f144d27ae10b
  + 	X90bdbcdbb6ea7156068e3dcfb7459244
  + 	X978f480a6e3cced51e297fbff9a506b7
    	"""
    )

After this change:
    strings.Join({
  + 	"X",
    	"d5c14bdf6bac81c27afc5429500ed750\n",
  + 	"X",
    	"25483503b557c606dad4f144d27ae10b\n",
  + 	"X",
    	"90bdbcdbb6ea7156068e3dcfb7459244\n",
  + 	"X",
    	"978f480a6e3cced51e297fbff9a506b7\n",
    }, "")
@dsnet dsnet merged commit 9181d1e into master May 25, 2021
@dsnet dsnet deleted the diff-lines branch May 25, 2021 01:23
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.

None yet

2 participants