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

we still have multiple issues regarding performance for select all, doing undo and redo, movement improved but can be more #174

Open
l3enQ opened this issue Jan 23, 2024 · 3 comments

Comments

@l3enQ
Copy link
Contributor

l3enQ commented Jan 23, 2024

          we still have multiple issues regarding performance for select all, doing undo and redo, movement improved but can be more

Originally posted by @l3enQ in #170 (comment)

@HamedMasafi
Copy link
Contributor

Not just select all nodes. There is a problem of selecting a large number of nodes.

My initial checks in the past few hours show that the trigger has a lot of CPU usage

https://github.com/Roniasoft/NodeLink/blob/main/resources/View/Helpers/SelectionHelperView.qml#L93

My test method:

  1. Open simpleNodeLink example 
  2. Load a previously saved file that contains a lot of nodes
  3. Select all (or almost all) the nodes by mouse drag
  4. Close the app

I'd profile the app using this simple senario (for just focusing on the selection) and in the result:

  • The timer that I linked was only executed twice, but it took a large part of the CPU consumption.
  • The trigger method of this timer takes 64% of the CPU clock, 61% of which is in line 103.
  • As a result, This method is executed for all nodes and the selectedModelChanged signal is emitted for each one. 

I am trying to find a way to emit this signal once and optimize the code

@HamedMasafi
Copy link
Contributor

HamedMasafi commented Jan 24, 2024

Update 1:

I changed the code so that the selectedModelChanged signal is emitted only once, but the problem was not solved (Of course, this change should be applied in any case).

This method still consumes a lot event in case of emitting the signal once.

This is the execution time of this method, as the number of selected nodes increases, the execution time also increases (in this process, the mouse button is not released).

qml: Elapsed time 114 ms  in  8  item(s)
qml: Elapsed time 902 ms  in  75  item(s)
qml: Elapsed time 1269 ms  in  109  item(s)

Apparently, the problem is due to the bindings given to property SelectionModel.selectedModel. In places like checking if node is selected or not.

Currently, I am trying to understand where this binding takes the most time.

Update 2:
There are a lot of reference to selectedModel in the project. I must check all of them and find a more optimal way .

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

No branches or pull requests

2 participants