Closed stayradiated closed 10 years ago
The method is better, but could still be improved. Most notably the sorting code block.
Just realised that loading lists with lots of tasks is crazy slow.
Going to do some benchmarking and will report back here with some info.
Lag starts to be noticable around 20 - 30 tasks.
Noticing a lot of memory usage, not sure what is causing that.
I've got a video of just how much lag is caused as tasks are added. https://www.dropbox.com/s/nitgmox062ss5lc/Nitro%202.1%20-%20Lag.mov
Memory usage went from 30mb up to 150mb.
I commented everything out of the tasks.render method and reduced the template to the minimal amount of html as possible.
This sped things up a lot: https://www.dropbox.com/s/7kqrfrlrosan6lv/Nitro%202.1%20-%20Quick.mov
Now I just need to go through and re-enable each part of the method and find what is causing the lag.
Lag has definitely got something to do with the memory leak.
With 100 tasks the memory was at ~11mb.
But after switching between inbox and all tasks a couple times, it steadily rose to 200mb.
Somehow the views are not being removed properly.
Still using quite a bit of memory, but at least it isn't leaking as much.
The Tasks.render() function is crazy.
We can either have each task_item create it's own element and bind to it, or we can create all the elements in one go, and bind them to tasks after.
At the moment we do both, and it's silly.
I'm thinking we should go with second approach, as it is what we used before and is probably faster.