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

App freezes for a while when there are a lot of annotations #139

Open
jeanineharb opened this issue Feb 27, 2018 · 7 comments
Open

App freezes for a while when there are a lot of annotations #139

jeanineharb opened this issue Feb 27, 2018 · 7 comments

Comments

@jeanineharb
Copy link
Contributor

I have deployed Beaverdam on a public cloud, and I am using it to annotate multiple objects.
When there are a lot of annotations on a video, the app freezes for a while (3-4 seconds) every time I try to add or resize an annotation.
I suspect it is because of the GUI elements (keyframebar, annotationbar, svg elements) being continuously reloaded after every action.
Any idea how to fix this?

@antingshen
Copy link
Owner

Hmm, how long is your video? And how many annotations (visible and hidden) are we talking about?

@szhu

@jeanineharb
Copy link
Contributor Author

My videos are between 5 and 10 minutes long.
The interface is freezing for a video that has around 2000 annotations (individual keyframes).

@szhu
Copy link
Collaborator

szhu commented Feb 28, 2018

Can you use Chrome's DevTools and capture a profile of the slow load? In DevTools, click the Performance tab then click record before the freeze happens, then stop recording after the page is responsive again. Then the Bottom-up and Call Tree tabs on the bottom can help us figure out what the slow functions are.

You can attach a screenshot of both profiler tabs and/or save the profile and attach a link to that. If you're looking for a free way to share the profile link, you can try using CloudApp -- I think it's free.

@clayshieh
Copy link
Collaborator

clayshieh commented Feb 28, 2018

It's probably because the js does a for loop search through all the keyframe comparing the time of each keyframe to the current video time +/- some delta to find the current key frame as well as reinserting the keyframe when updating it. You can probably verify this if the problem only occurs when you edit annotations that are later in the video compared to editing annotations in the beginning of the video.

Edit: the getFrameAtTime() function in annotation.js is used for both inserting and updating (updateKeyFrame()) and deleting (deleteKeyFrameAtTime()) key frames

@jeanineharb
Copy link
Contributor Author

@szhu Here is the profile for when I move an existing annotation.
profile.txt

@clayshieh I notice the same lag whether it is at the beginning or at the end of the video. I believe it's because the following handlers are triggered for every action, therefore the json data containing the annotations is getting parsed and processed over and over again:

$(this).triggerHandler('change-onscreen-annotations');
$(this).triggerHandler('change-keyframes');

Thank you both for your replies.

@szhu
Copy link
Collaborator

szhu commented Mar 1, 2018

Sorry, I can't load your profile for some reason. I get a blank "Performance" tab with no error message, even when running the server from localhost:9229 like you did. You can try one of the following:

  • Attaching screenshots of the relevant tabs in the Performance tool
  • Try to figure out Performance tool works to figure out which function(s) are taking a long time
  • Attaching a set of annotations (I forget how to export them) and a video that can be used to reproduce this issue

@jeanineharb
Copy link
Contributor Author

@szhu Thank you once again for your reply. I had not deployed Beaverdam on localhost:9229 but on a private IP address with port 5000.
Here are some screenshots of the Performance tool, and I have also attached another profile corresponding to these screenshots.
screenshot from 2018-03-16 15-35-16
screenshot from 2018-03-16 15-35-23
screenshot from 2018-03-16 15-35-29
profile-20180316.txt
Much appreciated.

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

4 participants