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

3-4 second lag when modifying shapes #1141

Closed
petermlyon-zz opened this issue Feb 13, 2020 · 7 comments
Closed

3-4 second lag when modifying shapes #1141

petermlyon-zz opened this issue Feb 13, 2020 · 7 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@petermlyon-zz
Copy link

Hi Guys,

First I wanted to say thanks for developing and maintaining this tool. It's invaluable for me :)

We are having a minor issue with lag when modifying existing shapes. These polygon annotations have quite a lot of points. The SVG definitions from one of my problem cases is attached, SvgjsPolygon22040 is the shape I am modifying when able to reliably reproduce this issue.

The issue precisely is that usually after moving 30-40 points in a session, there starts to be an occasional 3-4 second freeze when moving points (every 4-5 points or so). I can carry on clicking and moving points during the freeze, and the system catches up again afterwards.

The system is very responsive immediately before and after the lag. It doesn't appear to be a resource issue on the machine that is being used, but it is reminiscent of hard-drive buffering. I've reproduced it in chrome 80 on windows and chrome 79 on Linux. I'm wondering if it could be some kind of chrome optimisation that needs to be disabled.

This isn't a major issue to productivity as saving the shape and refreshing the editor fixes the problem, but I'm just wondering if there is any trick to preventing this issue, I've tried running chrome options to disable disk buffering but to no avail.

Thanks in advance for all comments and suggestions.

svgdefs2.txt

@bsekachev
Copy link
Member

@petermlyon

Hi,
Could you please record a profile in google chrome and send it us to investigate?

@petermlyon-zz
Copy link
Author

Hi,

Between 28.49s and 36.49s there are several drag operations.

  • The first one is responsive, and can be seen occurring in the images from the captured profile.
  • The second and third drag operation are made around 31-32 seconds but don't update the UI until around the 36 second mark

If you need any more info let me know :)

Around
chrome debug profile cvat 17-02-2020.zip

@bsekachev
Copy link
Member

@petermlyon

Hmm.
Yes, I see that event resizedone takes 2.32 sec.
And it is only scripting there.

Examples of polygons you attached actually is not very large. I usually can work with polygons where > 100 points without any problems.
What about hardware of the computer? Mostly I am interested in CPU, but other parameters would not be extra information.

@petermlyon-zz
Copy link
Author

So the thing I've noticed with this is it seems to be related to the number of pending edits to a shape. I don't know how the underlying data-structure differs between editing and creation so not sure if that is helpful?

This test was done on a machine with an i7-7700HQ, 16GB of RAM and SSD. I've also reproduced this result on a machine with an AMD 6 core & 6GB of RAM, as well as an i5 quad core with 8GB of RAM.

@bsekachev bsekachev added the bug Something isn't working label Feb 19, 2020
@bsekachev
Copy link
Member

@petermlyon

Investigated it.
Looks like a performance issue in svg.js library.
Array::indexOf is hotspot in this case.

Screenshot from 2020-02-19 12-15-55

I am not sure about fast fix here. On the one hand I see wrong method of working with an array in the library. On the other hand we might use the library somehow else.

@bsekachev
Copy link
Member

@petermlyon

The patch #1197 is expected to help.
Let me know if it does.

@bsekachev
Copy link
Member

One more problem was found.
It has been introduced with the PR above.
Finally I would recommend to update with #1212.

Also I will close the issue for now.
Do not hesitate reopen it if you still has problems with performance after update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants