Skip to content

Give up and assume diff is too large - #4052

Closed
iAmWillShepherd wants to merge 5 commits into
masterfrom
know-when-to-give-up
Closed

iAmWillShepherd wants to merge 5 commits into
masterfrom
know-when-to-give-up

Conversation

@iAmWillShepherd

@iAmWillShepherd iAmWillShepherd commented Feb 20, 2018 •

Copy link
Copy Markdown
Contributor

Please make sure this is merged before PR #4050, so that I can fix merge conflicts in that branch

I noticed this issue while working on PR #3980, which is now closed to make code review easier. Shoutout to @shiftkey for letting me know that spawn can be given the maximum number of bytes to read.

Notice how long it takes the UI to catch up and let me know the diff can't be displayed. This changes means that we give up sooner and assume a diff is too large so the UX can be a bit better.

Before

before

After

after

@iAmWillShepherd iAmWillShepherd added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 20, 2018
@niik niik self-assigned this Feb 20, 2018
@tierninho

Copy link
Copy Markdown
Contributor

✅ tested for UI and functionality

@shiftkey shiftkey added this to the 1.1.x milestone Feb 22, 2018
Comment thread app/src/lib/git/diff.ts
* buffer before _assuming_ the current buffer being read is `MaxDiffBufferSize`.
* This is done so that the UI isn't waiting for the entire buffer to be read.
*/
const MaxBytesToRead = MaxDiffBufferSize / 8 //~32MB

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/lib/git/diff.ts
MaxBytesToRead
)
if (isBufferTooLarge(output)) {
if (!didReadAllBytes || isBufferTooLarge(output)) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/lib/git/diff.ts
MaxBytesToRead
)
if (isBufferTooLarge(output)) {
if (!didReadAllBytes || isBufferTooLarge(output)) {

This comment was marked as spam.

Comment thread app/src/lib/git/diff.ts
* buffer before _assuming_ the current buffer being read is `MaxDiffBufferSize`.
* This is done so that the UI isn't waiting for the entire buffer to be read.
*/
const MaxBytesToRead = MaxDiffBufferSize / 8 //~32MB

This comment was marked as spam.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

So, it looks like we won't need this PR anymore since we limit diff sizes to 70MBs due to larger diffs not rendering completely (see comment). Before, the max diff size was around 256MB and waiting up to 10 seconds just for the UI to update and show the diff was too large to render was unacceptable; however, at 70MB, the max time to wait is around 1-2 seconds max. Going to close this out since the delay is no longer an issue.

@rafeca
rafeca deleted the know-when-to-give-up branch July 22, 2020 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants