Skip to content

Conversation

@Doublonmousse
Copy link
Collaborator

Fixes #1436
(and maybe #1438, waiting on a response)

  • use push_repeat for background nodes : This seems to reduce RAM usage and buffer uploads to the gpu so there's more headroom for the rest of the nodes
  • use the rtree to speed up regenerate_rendering_in_viewport_threaded : We use the rtree to get the strokes in the viewport without recalculating any stroke bounds, and get the ones not in the view by iterating on keys and using a hashmap to filter out the previously selected ones

On that subject, it seems we could use a https://docs.rs/slotmap/1.0.7/slotmap/sparse_secondary/struct.SparseSecondaryMap.html for the render components and/or be smarter on clearing the render_comp components of strokes (we know there's no work to do if we have x strokes in view that we just initialized the rendering components and x strokes in the rendering component slot)

I've updated the rtree to only keep bounds for visible strokes (so trashed strokes are removed from the tree)

I've also added to the visual debug mode a way to see the envelope of the whole rtree (marked by orange bounds)

This diminishes the cost for this
- one element of somewhat fixed size (no vec pushing)
- one element given to gtk that can tile this as it pleases with less buffer pushes
We use the rtree to find the element in the viewport, mark these ones using a hashmap, call the rendering function, then remove the rest by iterating on the keys a second time, filtering on keys not in the hashmap
Do not leak key trees out of the store structure
@Doublonmousse Doublonmousse added the performance Related to app performance label Jun 8, 2025
Copy link
Owner

@flxzt flxzt left a comment

Choose a reason for hiding this comment

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

when this lands these are nice improvements to the rendering part of the engine. I added some comments

@flxzt
Copy link
Owner

flxzt commented Jun 28, 2025

Only storing non-trashed strokes in the R-Tree is problematic and will require additional changes in other parts - essentially everywhere where one of the methods of KeyTree are used (like keys_in_bounds(), keys_intersecting_bounds() etc. Right now they are all used under the assumption that all strokes are included in the tree. Did you consider this?

@Doublonmousse Doublonmousse marked this pull request as draft June 29, 2025 11:56
that would push a 'current' stroke key to the rendering keys
And remove now superfluous filters on the trash status for the outputs of the `key_tree`
…ectly

The information is there already, and it is probably more effective to get the value from the keytree rather than recalculating it on the fly on each event
@Doublonmousse
Copy link
Collaborator Author

I'm trying to rely more on the keytree to get stroke bounds whenever possible (as calculating a bunch of stroke bounds on each event is potentially pretty expensive).

Testing the two keytree solution, I'm encountering quite weird results with the splitting eraser

@Intranox

This comment was marked as off-topic.

@flxzt
Copy link
Owner

flxzt commented Sep 23, 2025

good to know, but not really relevant for the technical discussion this PR should focus on @Intranox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Related to app performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance degrades on larger files

3 participants