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

Change how textdiff settings changes are handled #1284

Merged
merged 4 commits into from
Mar 3, 2020

Conversation

campersau
Copy link
Collaborator

Fixes performance issues with signal and should use less memory.
This is the PR for one of my proposals from #1091 (comment)

this.isShowingDiffs.subscribe(newValue => {
if (newValue) this.render();
});
this.textDiffType.value.subscribe(() => {
if (this.isShowingDiffs()) this.render();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a change in type no longer invalidate the diffs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because it isn't needed.
The diff type setting and "load more" are client side features and don't require server requests.
The whitespace setting on the other hand is a git feature and requires a server request.

block.lines = block.allLines.slice(0, remaining);
} else if (block.allLines) {
block.lines = block.allLines;
block.allLines = undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at block level, is there a reason to have allLines separately?

We could loosely follow the line count restrictions. if limit is 10 and we first block has 12 lines of code, we could just display all 12 lines without doing this.

Not sure if it is worth to follow that diff line limit strictly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was there before (we implemented it like this 5 years ago 7bcd34c). I just changed it to enable "loading more" without invalidating the diff (reverting and really fixing #876).
But yes, beeing strict has also some bugs like this one where the whitespace changes are only visible after loading the hole block:

image

But one code block could also be huge like hundreds of lines and defeating the purpose of #376...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure there are some tech debts here. If I remember correctly, the main cause of inefficiencies targeted in #376 was due to animation loop moving many elements and triggering recalculations that was blocked by animation loop due to large diff box opened up, which ultimately addressed in #630. Performance part of the incremental load shouldn't be a consideration any more.

However, if we are concerned by unexpectedly adding large block. We could do conservative approach and load only that is below the limit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the logic to always load complete blocks as long as the load limit is not reached.

@campersau campersau merged commit 205fdbc into FredrikNoren:master Mar 3, 2020
@campersau campersau deleted the textdiffsettings branch March 3, 2020 08:25
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.

3 participants