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

sync: Render "fetching" vs "fetched but not scanned" cells separately #20

Merged
merged 1 commit into from
May 21, 2024

Conversation

str4d
Copy link
Collaborator

@str4d str4d commented May 20, 2024

No description provided.

Copy link
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

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

utACK

@str4d
Copy link
Collaborator Author

str4d commented May 20, 2024

Hmm, running this today I'm seeing some noticeable lag / slowdown in the TUI update pipeline that I think results from this PR. Gonna leave this PR unmerged for now and see if I can figure out where the issue is.

Comment on lines 231 to 242
let cell = if self
.fetching_range
.as_ref()
.map(|range| range.contains(&cell_start) || range.contains(&(cell_end - 1)))
.unwrap_or(false)
.fetching_set
.iter()
.any(|h| (cell_start..cell_end).contains(h))
{
Some(("↓", Color::Magenta))
} else if self
.fetched_set
.iter()
.any(|h| (cell_start..cell_end).contains(h))
{
Some((" ", Color::Magenta))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Figured it out: the slowdown was due to switching from storing fetching_range as a Range to using a BTreeSet. The latter is what we functionally need, but it was too slow for how we were using it, and that was slowing down this part of the render loop (deciding what colour to mark a cell). The effect flew under the radar for small TUI sizes, but with large sizes there were many more cells to check, so the effect became noticeable. That in turn caused the Action queue to back up, which eventually caused all other queue actions to slow down as well (like responding to shutdown requests).

I'm fixing this by switching to a RoaringBitmap (from the roaring crate), which has the same functionality but much better performance.

@str4d str4d force-pushed the defrag-refine-fetching branch from 6186363 to 519101f Compare May 21, 2024 15:28
@str4d
Copy link
Collaborator Author

str4d commented May 21, 2024

Force-pushed to fix performance problems.

Copy link
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

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

utACK 519101f

@str4d str4d merged commit 7f5ca04 into main May 21, 2024
17 checks passed
@str4d str4d deleted the defrag-refine-fetching branch May 21, 2024 15:53
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