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

Performance Optimizations and Viewport Feature #135

Merged
merged 20 commits into from
Mar 27, 2024
Merged

Conversation

LeandroTreu
Copy link
Collaborator

  • Various rendering and mousehandler optimizations that increase FPS and decrease CPU utilization
  • Implements feature request that binds viewport to graph bounds (no out of bounds panning)

@LeandroTreu LeandroTreu requested a review from phschaad March 22, 2024 11:29
Copy link
Collaborator

@phschaad phschaad left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, only minor cleanup changes and a question - very nice work, thank you!

this.draw_async();
// console.log(SDFGRenderer.rendered_elements_count)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// console.log(SDFGRenderer.rendered_elements_count)

continue;
}

block.draw(renderer, ctx, mousePos);
block.debug_draw(renderer, ctx);
// SDFGRenderer.rendered_elements_count++;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// SDFGRenderer.rendered_elements_count++;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the commented out versions elsewhere too

@@ -150,6 +150,7 @@ export class SDFGRenderer extends EventEmitter {
protected bgcolor: string | null = null;
protected visible_rect: SimpleRect | null = null;
protected static cssProps: { [key: string]: string } = {};
public static rendered_elements_count: number = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where's this used, or what for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Debug helper variable that I forgot to remove again! I counted the amount of elements drawn to screen to see if there is correlation between that and low FPS. There was no correlation and I had to search for more specific causes (already fixed with later commits).

@@ -2568,6 +2740,7 @@ export function drawSDFG(
const ppp = cManager.points_per_pixel();
const visibleRect = renderer.get_visible_rect() ?? undefined;

SDFGRenderer.rendered_elements_count = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a vestigial too or does this still serve a function?

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 function other than debug. I will remove it again.

@tbennun
Copy link
Contributor

tbennun commented Mar 22, 2024

Two questions:

  1. Why remove disabling the adaptive view configuration? Some users use it for exporting images.
  2. I noticed some edge bound checking code was removed in favor of edge LOD. Some of those checks were used to ensure the canvas size itself is not too large (massive performance impact) in case the edge goes further out than the current viewport. Is that still checked?

Nitpicky comment: please spell check your comments in the code. I saw “timout” and “its” (that should be it’s”)

@phschaad
Copy link
Collaborator

  1. Why remove disabling the adaptive view configuration? Some users use it for exporting images.

I would be OK with leaving it in if we add a warning behind it or something similar. The issue is currently that if it's enabled, you are able to navigate huge graphs without any problems, but the moment you turn it on you can crash your browser if it's not equipped to handle the immediate resource demand. That's what we would like to avoid.

@LeandroTreu
Copy link
Collaborator Author

Yes exactly, as @phschaad said, turning the setting off will turn off all optimisations and will make navigation impossible on huge graphs. As I only removed the user setting in the settings menu, the boolean for this switch is still present and exporting with "Save SDFG as PDF" still works as before. BUT this feature is also currently broken (also on current master branch) for huge graphs, at least the ones I'm using for benchmarking, and I will take a look at why in the coming days. Before my next pull request I will make sure that all image exporting features work as intended as before.

@LeandroTreu
Copy link
Collaborator Author

  1. I noticed some edge bound checking code was removed in favor of edge LOD. Some of those checks were used to ensure the canvas size itself is not too large (massive performance impact) in case the edge goes further out than the current viewport. Is that still checked?

@tbennun I checked my changes again and I cannot find the code where I changed something that has to do with what you described. Can you maybe let me know which commit/code parts you are referring to? I can't recall that I have removed any code that has to do with edge bounds checking.

Copy link
Contributor

@tbennun tbennun left a comment

Choose a reason for hiding this comment

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

LGTM

@phschaad phschaad merged commit 8df3afc into master Mar 27, 2024
2 checks passed
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