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 is very slow with many tasks #27

Closed
mattenklicker opened this issue Dec 23, 2016 · 21 comments
Closed

App is very slow with many tasks #27

mattenklicker opened this issue Dec 23, 2016 · 21 comments
Milestone

Comments

@mattenklicker
Copy link

I like the tasks app and so I have around 200 tasks. At this number the browser is stuck for several seconds in javascript hell when loading the tasks. Adding/Editing a task is also painful, every letter appears several seconds after typing. To look up tasks in a mobile device is completely impossible.

Are there any plans to improve the scalability?

@raimund-schluessler
Copy link
Member

This is a problem with Angular and I am not sure, if or how we can solve this. Maybe it is getting better with Angular2 but I am very unsure about this.

@nachoparker
Copy link
Member

same problem here, It is getting really painful.

I might have a look at the source to see if at least I can disable whatever JS is doing while I type.

I do not understand why having many tasks affects the text box. I do not want any JS processing on the textbox as I type.

Before I spend my time diving in... does anybody know the reason behind this? what processing is being done?

@raimund-schluessler
Copy link
Member

We might be able to solve this by switching to Vue.js.

@raimund-schluessler raimund-schluessler changed the title tasks app is getting slower with growing number of tasks App is very slow with many tasks Jul 22, 2017
@nachoparker
Copy link
Member

nachoparker commented Jul 25, 2017

that would be great. It is borderline unusable. Just out of curiosity, what is the reason that it runs javascript as I type? any quick hack to disable it for the time being?

edit: btw, congrats for the app. It's awesome and I can't live without it

@nachoparker
Copy link
Member

Bump

Please, I would like to attract attention to this. It makes the whole app borderline unusable for serious usage (many tasks).

IMHO everything else can wait, because the basics don't work well. Repeating tasks and all the rest looks good but if you can't have a bunch of tasks... what is the point?

Please, prioritize this. Thank you

@nachoparker nachoparker added bug and removed bug labels Aug 15, 2017
@raimund-schluessler
Copy link
Member

What is "a bunch of" tasks? About how many tasks do we talk (subtasks count as separate task)?

@nachoparker
Copy link
Member

nachoparker commented Aug 15, 2017

hi, thanks for paying attention to this

It has been gradually deteriorating, to the point that now I type the task, and wait 10 seconds for the text to appear.

At this point I have 105 open tasks and 435 completed tasks. I now always delete instead of marking them as complete because I fear that will make things worse. Also, there is no simple way of cleaning up completed tasks ( I think there is a feature request with this ).

Like I said, it does not even let me type. I don't even understand what is the point of the per key hit javascript processing that involves iterating all other tasks.

Thanks again

edit: I guess I could try to delete them from the database, but still the app is broken IMHO

@nachoparker
Copy link
Member

Also, I would like to mention that I have 6 'calendars' or 'task lists'. I don't think that affects though

@raimund-schluessler
Copy link
Member

raimund-schluessler commented Aug 15, 2017

Completed tasks are not loaded after a page reload by default. They will only be loaded if you click on "Load remaining completed tasks" below the task list (or if you open their parent task). So, completed tasks are only on the server, but not in the app. This is already for performance reasons and deleting instead of completing tasks will not improve performance. In case completed tasks are loaded for you, please file an issue.

I currently have 40 tasks in the app and it runs smoothly. There is no lag when typing into the task input bar and the task appears quasi immediately when I hit enter. Now, 40 is not 100, but I still wonder why it is so bad for you?!

Edit: Hm, I loaded 200 completed tasks and typing now has a lag.

@nachoparker
Copy link
Member

nachoparker commented Aug 15, 2017

In case completed tasks are loaded for you, please file an issue.

They are not, thanks for the info

still wonder why it is so bad for you?!

Probably because firefox without e10s enabled : S

Still, does not make sense to me that there is any JS processing while you type... what is it for?

I tried to do some basic debugging some time ago, and I found the breakpoint for the code flow when it triggers, but IIRC it was only testing for the escape code, so it didn't look like it was doing much processing.

There's obviously something, I just didn't see it in my quick investigation

Edit: Hm, I loaded 200 completed tasks and typing now has a lag.

Edit: great, first step... able to reproduce!

@damien-rembert
Copy link

damien-rembert commented Aug 15, 2017

Probably because firefox without e10s enabled : S

Well I'm using Chrome and it's the same for me (around 150 tasks).

@nachoparker
Copy link
Member

nachoparker commented Aug 15, 2017

Well I'm using Chrome and it's the same for me (around 150 tasks).

"good" to know (not really). You know FF uniprocess normally less performant in the javascript engine, so I assume it will be more noticeable in FF ;)

@raimund-schluessler let me know how I can help

@raimund-schluessler
Copy link
Member

The task input is to be found here:
https://github.com/nextcloud/tasks/blob/master/templates/main.php#L153-L156

We do check every keystroke, because we want to react on the user pressing escape, but this should not become worse with multiple tasks. You can check though, if it helps to remove ng-keydown="checkTaskInput($event)" but I doubt that a bit.

I assume the problem is ng-model="status.taskName" which we use to have the name of the new task. I guess we could replace that with something that only reacts when the form is submitted.

@nachoparker
Copy link
Member

We do check every keystroke, because we want to react on the user pressing escape,

Yeah, that's what I saw

this should not become worse with multiple tasks

That's what I thought... maybe there's some hidden magic in the angular component?

I did try removing eventhandlers and things, but didn't work for me. Not that I tried hard to understand the code.

I just tried again, removing the ng-keydown hook from templates/main.php and templates/part.taskbody.php and it didn't do it for me.

This happens to me on all the text boxes: the main one to add a new task, the one to rename an existing task (it changes as you type in the list as well), and in the notes for an existing task

@raimund-schluessler
Copy link
Member

They all have ng-model set. See:
https://github.com/nextcloud/tasks/blob/master/templates/part.details.php#L15
https://github.com/nextcloud/tasks/blob/master/templates/part.taskbody.php#L50-L57

ng-model also reacts immediately to keystrokes. You could check by removing this directive (of course adding a task will not work then anymore).

@nachoparker
Copy link
Member

I tried removing both ng-keydown and ng-model from those files, and sure enough the app breaks, but still I cannot type fluidly. There is some JS triggering still

@nachoparker
Copy link
Member

Hi,

Any plans to work on this? It really makes heavy usage impossible

@SehLax
Copy link

SehLax commented Jan 3, 2018

my firefox just showed me the "script is probably damaged" warning as it took too long typing :-D
and pointed to

Component.prototype.getAllSubcomponents@/apps/tasks/js/vendor/ical.js/build/ical.js?v=658ad51f51c085f1ab51904cd6db813a-7:2162:15
get related@/apps/tasks/js/public/app.js?v=658ad51f51c085f1ab51904cd6db813a-7:4291:16
TasksModel</TasksModel.prototype.hasNoParent@/apps/tasks/js/public/app.js?v=658ad51f51c085f1ab51904cd6db813a-7:3948:0
TasksController/this._$scope.hasNoParent/<@/apps/tasks/js/public/app.js?v=658ad51f51c085f1ab51904cd6db813a-7:1144:12
ng/<@/apps/tasks/js/vendor/angular/angular.min.js?v=658ad51f51c085f1ab51904cd6db813a-7:161:355
anonymous/fn@SCRIPT0:2:1170
N/c<@/apps/tasks/js/vendor/angular/angular.min.js?v=658ad51f51c085f1ab51904cd6db813a-7:128:157
n.event.dispatch@/core/vendor/core.js?v=658ad51f51c085f1ab51904cd6db813a-7:3:6413
n.event.add/r.handle@/core/vendor/core.js?v=658ad51f51c085f1ab51904cd6db813a-7:3:3223

when I put a halt point there in the getAllSubComponents function of ical.js it halts a lot, with every task arriving 4 times as an object in comps

then I realized it's being called from get completed (app.js

and that is being called from CollectionsModel.prototype.getCount = function(collectionID, filter)
(app.js:3567) cycling through, hmm, at least a lot of tasks, with the count of starred tasks going up slowly.
tasks, in my case is an array of 168 task objects, and the for loop in app.js:3565 is going through all of them.

ok, one step up, it's being called from app.js:802 this._$scope.getCollectionString = function(collectionID), which is cycling through all the collections (current, starred, today, ...)

well, it takes some time, but why is it even being called when all the lists seem ready?
now, putting a halt point there at app.js:804, I see it's called always when I click anywhere in the app window. well, the rest of callees is fucking minified and I don't understand shit ;-)

screenshot_20180103_140618_tasks-app

does that help in any way?

@thmo
Copy link

thmo commented Jan 8, 2018

Here, the app is also slow with only a handful of tasks (8-10). Especially adding a new task is painful, as there is a delay for every keystroke.

Reloading the page helps, though.

@dmp1ce
Copy link

dmp1ce commented Aug 2, 2018

I am also experiencing a slowdown with many tasks. I have about 170 active tasks with probably around 1000 completed tasks. I'm using Firefox on Arch Linux.

@raimund-schluessler
Copy link
Member

Fixed with #194.

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

No branches or pull requests

7 participants