Thunderbird processing / "Not Responding" 5 to 30 minutes at startup with 63.0beta + Lightning 6.5 and 64.0b1 + Lightning 6.6 after upgrade, and also "Unresponsive Script" - Performance issues in unifinder.js
Categories
(Calendar :: General, defect)
Tracking
(Not tracked)
People
(Reporter: richard.leger, Assigned: richard.leger)
References
(Blocks 2 open bugs, )
Details
(Keywords: perf, Whiteboard: [not regression])
Attachments
(20 files)
6.23 KB,
image/png
|
Details | |
34.00 KB,
image/png
|
Details | |
64.17 KB,
image/png
|
Details | |
3.59 MB,
image/jpeg
|
Details | |
35.13 KB,
image/png
|
Details | |
36.15 KB,
image/png
|
Details | |
109.51 KB,
image/png
|
Details | |
14.47 KB,
image/png
|
Details | |
4.65 MB,
application/x-zip-compressed
|
Details | |
1.52 MB,
application/x-zip-compressed
|
Details | |
463 bytes,
text/plain
|
Details | |
463 bytes,
patch
|
Details | Diff | Splinter Review | |
909 bytes,
patch
|
Details | Diff | Splinter Review | |
1.72 KB,
patch
|
darktrojan
:
review+
|
Details | Diff | Splinter Review |
3.10 KB,
patch
|
darktrojan
:
review+
|
Details | Diff | Splinter Review |
5.59 KB,
patch
|
Details | Diff | Splinter Review | |
3.68 KB,
patch
|
pmorris
:
review+
|
Details | Diff | Splinter Review |
64.58 KB,
application/pdf
|
Details | |
5.39 KB,
application/x-zip-compressed
|
Details | |
10.84 KB,
text/plain
|
Details |
Assignee | ||
Comment 1•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Comment 2•6 years ago
|
||
Assignee | ||
Comment 3•6 years ago
|
||
Assignee | ||
Comment 4•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
Assignee | ||
Comment 7•6 years ago
|
||
Assignee | ||
Comment 8•6 years ago
|
||
Assignee | ||
Comment 9•6 years ago
|
||
Comment 10•6 years ago
|
||
Assignee | ||
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
Assignee | ||
Comment 13•6 years ago
|
||
Assignee | ||
Comment 14•6 years ago
|
||
Assignee | ||
Comment 15•6 years ago
|
||
Assignee | ||
Comment 16•6 years ago
|
||
Assignee | ||
Comment 17•6 years ago
|
||
Assignee | ||
Comment 18•6 years ago
|
||
Assignee | ||
Comment 19•6 years ago
|
||
Assignee | ||
Comment 20•6 years ago
|
||
Assignee | ||
Comment 21•6 years ago
|
||
Assignee | ||
Comment 22•6 years ago
|
||
Assignee | ||
Comment 23•6 years ago
|
||
Assignee | ||
Comment 24•6 years ago
|
||
Assignee | ||
Comment 25•6 years ago
|
||
Assignee | ||
Comment 26•6 years ago
|
||
Comment 27•6 years ago
|
||
Comment 28•6 years ago
|
||
Comment 29•6 years ago
|
||
Assignee | ||
Comment 30•6 years ago
|
||
Assignee | ||
Comment 31•6 years ago
|
||
Assignee | ||
Comment 32•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
(In reply to Richard Leger from comment #26)
Hi MakeMyDay,
As you would see in my many comments above, the issue seems to lie in
Thunderbird/Lightning at the moment...I suspect this bug 1502923 may have been caused by (or be consequence of)
changes implemented earlier this year as described in Bug 1439900 "Move
unifinder related functions to calUnifinderUtils.jsm". It could also well be
that the problem always existed but may have been emphasised somehow by
those changes...Would you be able to help further to troubleshoot and have this issue sorted
somehow?
Sorry Richard, I have not too much time at the moment as you might have already noticed. You seem to have done an awesome job to debug the issue (though I have to admit I haven't read everything now).
If it would be related to bug 1439900, you would most probably see error messages in the error console. I assume the issue existed before but you didn't notice, since the vector of potentially relevant settings and conditions is quite hugh.
I will try to come back to this bug if I get some more time.
Assignee | ||
Comment 35•6 years ago
|
||
Hi,
(In reply to [:MakeMyDay] from comment #34)
Sorry Richard, I have not too much time at the moment as you might have already noticed.
I understand you may not have time yourself, but could you have someone else from the TB Dev team to look into it urgently?
This is a critical bug that impact performance of TB drastically. It has been 4 months that the issue has been reported and no-one seems to have look into it so far from the TB dev team.
Because of this bug, some TB users have to wait from 5mn to 20mn before being able to use TB when they open it. The current possible work around cannot be considered as a solution and is not workable for most users as it needs to be set prior they close TB which most users forgot to do, causing them headache next time they open TB.
When issue occurs, it is impossible to use TB or access even emails!!!
This should be set as critical bug and be sorted out urgently by the next stable release, it cannot wait any longer...
Could you or someone else have a look at it urgently?
Would really appreciate your help as this is as a huge impact for end-users at the moment and is damaging to TB image and reputation forcing people to consider using alternative software... as TB become not fit for purpose :-)
The impact on user base is growing as this bug has now made its way in the current stable release of TB!
Regards,
Richard
Assignee | ||
Comment 36•6 years ago
|
||
FYI, issue is still happening in Thunderbird 66.0b2 (32-bit).
TB remain unusable for between 5mn to 30mn when issue occurs (at startup).
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 37•6 years ago
|
||
Please keep the bug specifications pointing to the earliest version in which the issue is found.
Comment 38•6 years ago
|
||
workaround |
I had the same behavior (Thunderbird unusable and CPU at 100%) on Thunderbird 60.5.1 (latest debian stable) with Lightning 6.2.5. After setting the calendar to show only "Events in the Next 14 days" (as suggested in previous comments) the problem went away.
Maybe this guide should be updated with this workaround.
Assignee | ||
Comment 39•6 years ago
|
||
Wayne, I did left the earliest version mentioned when changing the title, my intention was to highlight in the title of the bug, the fact that it also affect 66.0b2 + Lightning 6.8.
I don't think the workaround can be considered as a solution as it does not always work... and the issue still cause major pain to end-users.
Why is this bug not looked at by someone?
All it would take to fix the issue is to prevent the view to re-order items EVERY time one is added in the list view.
Maybe just disable the ordering function for now... until long term fix is implemented (e.g run the sort function ONLY after the last item is added).
That shall not be that hard and long to quick fix for someone who is familiar with the code.
At the current speed, this bug would still be present in the next stable version of Thunderbird while it should be fixed by then.
It has been 4 months now this bug is present in TB for 6 version...
Comment 40•6 years ago
|
||
I understand your enthusiasm, unfortunately we haven't been able to find time for this bug. The sorting code has been there for more than 6 versions afaik, the bug you referenced just moved the code somewhere else.
This bug has accumulated a bunch of comments, and from what I understand the problem is sufficiently described. I think it would make sense to wait for someone to pick up this bug, they may have more specific questions.
Assignee | ||
Comment 41•6 years ago
|
||
I found what I believe is a simple fix for this bug.
In chrome://calendar/content/calendar-unifinder.js line 148 I would suggest to replace ...
unifinderTreeView.addItems(items.filter(filter.isItemInFilters, filter));
by
// Fix for bug Bug 1502923
unifinderTreeView.addItems(items.filter(filter.isItemInFilters, filter), true);
Notice the 'true' parameter added a the end of the addItems function...
Explanation...
Looking at the stack trace:
sortItems (calUnifinderUtils.jsm#108)
sortItems (calendar-unifinder.js#548)
addItems (calendar-unifinder.js#449)
addItemToTree (calendar-unifinder.js#148)
onAddItem (calendar-unifinder.js#87)
notify (calDataUtils.jsm#40)
notify (calDataUtils.jsm#68)
onAddItem (calCompositeCalendar.js#49)
notify (calDataUtils.jsm#40)
notify (calDataUtils.jsm#68)
onAddItem (calDavCalendar.js#3001)
notify (calDataUtils.jsm#40)
notify (calDataUtils.jsm#68)
adoptItem (calMemoryCalendar.js#164)
addTargetCalendarItem (calDavCalendar.js#1139)
endElement (calDavRequestHandlers.js#906)
onDataAvailable (calDavRequestHandlers.js#808)
You can see clearly that every time data is available and added to the tree, the sort function is called in an ever growing tree as data increased (added)... so the same sorting function occurs repetitively over an increasing amount of data so sorting become more and more lengthy time/processing consuming as data is added causing delay for the function/script to complete during which TB become "unresponsive".
The fix proposed above, would prevent the tree to be sorted every time data is added to the tree I believe.
Ideally the sorting shall occurs only once at the end when all data would have been added to the tree.
The addItems (calendar-unifinder.js#449) function accept an additional parameter called aDontSort which shall be used and set to 'true' to prevent sorting of the tree every time item(s) are appended.
(Is it normal that JavaScript does not raise an error indicating the parameter aDontSort is missing in the calling function?)
/**
* Add an item to the unifinder tree.
*
* @param aItemArray An array of items to add.
* @param aDontSort If true, the items will only be appended.
*/
addItems: function(aItemArray, aDontSort) {
this.eventArray = this.eventArray.concat(aItemArray);
let newCount = (this.eventArray.length - aItemArray.length - 1);
this.tree.rowCountChanged(newCount, aItemArray.length);
if (aDontSort) {
this.calculateIndexMap();
} else {
this.sortItems();
}
},
Assignee | ||
Comment 42•6 years ago
|
||
As you can see I keep hope :-) to fix that real bugger for end-users and help remove a damaging image of TB at the moment performing poorly :-(
I downloaded the source file from here:
https://dxr.mozilla.org/comm-central/source/comm/calendar/base/content/calendar-unifinder.js#148
Modified the file as I suggested and created the patch attached for testing and review at your end...
I don't think I have any way to test it directly unless it is published in one of the next beta version... It does not seem possible to modify code on the fly via the Debugger to see how the proposed fix behave...
Assignee | ||
Comment 43•6 years ago
|
||
Re-submitted as a patch :-)
Sorry forgot to tick option previously...
Comment 44•6 years ago
|
||
Thanks for keeping persistent on this issue, Richard. I haven't checked in detail, but it looks this fix would prevent also sorting if you create a new event via UI that should be in range. If sorting is confirmed to be the issue here, one would probably need to listen to running sync operations, supress sorting on adding while sync is in opertaion and refresh the sorting once all pending a<nc operations are completed.
If you want to test your changes without building yourself, you could copy the xpi from YourTB-installation/distribution/extensions, unzip it, do your modification, zip it again, rename it to xpi and overinstall it using the TB addons manager.
Disclaimer: If you do this with your production profile, make sure you have backed up your TB profile before and return to the regular instalation straight after doing your checks. To get back to the ditributed xpi, uninstall the modified version via addons manager, and follow these instructions [1].
Assignee | ||
Comment 45•6 years ago
|
||
That would greatly help, thank for tips...
As an additional note, coding wise, aDontSort parameter shall never be ommited in calling function because it does not have a default value set (as per addItems function definition), so in theory this means it is not designed to be ommited. It needs to be set explicitly to true or false.
(In reply to [:MakeMyDay] from comment #44)
Thanks for keeping persistent on this issue, Richard. I haven't checked in detail, but it looks this fix would prevent also sorting if you create a new event via UI that should be in range. If sorting is confirmed to be the issue here, one would probably need to listen to running sync operations, suppress sorting on adding while sync is in operation and refresh the sorting once all pending a<nc operations are completed.
Sorting may not be the only issue (I'll come back to that later once the sorting issue is sorted) but yes distinction need to be made if item is added from end-user via the UI (one item at a time) which could cause sorting [function call like: unifinderTreeView.addItems(items.filter(filter.isItemInFilters, filter), false) ], and item(s) loaded via network streams (item loaded one by one or in batch in thousands) which should not trigger sorting until after each item is added [function call like: unifinderTreeView.addItems(items.filter(filter.isItemInFilters, filter), true) ] but only at the end when all items have been added [last function call like: unifinderTreeView.addItems(items.filter(filter.isItemInFilters, filter), false) ]
Currently... when items are added at startup from network stream here is what happens...
- 1st item added ==> trigger sort on one item
- 2nd item added ==> trigger sort on two items
- 3rd item added ==> trigger sort on three items
You can clearly see that when adding thousands of items how this processing would be time/processing consuming and inefficient by designed.
What should happen instead...
- 1st item added
- 2nd item added
- 3rd item added
(...) - last item added ==> trigger sort on all items
In this case if there is one or thousands of items does not make difference as adding processing is quite fast... and sorting would only occurs once on the total of items, which is also fast (equivalent in speed to end-user clicking on the header column to sort in the UI).
If you want to test your changes without building yourself, you could copy the xpi from YourTB-installation/distribution/extensions, unzip it, do your modification, zip it again, rename it to xpi and overinstall it using the TB addons manager.
Thanks for the tip, I will give it a try when I get a spare chance. It is good to know I have way to test and fix. Unfortunately my debugger in b3 does not seems to properly stop correctly at my previous breakpoints at the moment making it more difficult to debug but haven't got a change to look into that yet! I suspect introduction of workers to handle the network stream and add items to tree do no longer trigger some of my previously set breakpoints.
Disclaimer: If you do this with your production profile, make sure you have backed up your TB profile before and return to the regular instalation straight after doing your checks. To get back to the ditributed xpi, uninstall the modified version via addons manager, and follow these instructions [1].
[1] https://support.mozilla.org/en-US/kb/calendar-updates-issues-thunderbird#w_lightning-disappears-after-a-thunderbird-update-release-and-beta-versions
I have setup a dedicated test profile for testing it so far :-)
Thank for the tip, I'll revert installation right after...
Assignee | ||
Comment 46•6 years ago
|
||
Also suggestion for later and long term to rename aDontSort into aSort and invert value/meaning. So value true would mean "sort after adding", false would mean "do not sort after adding"... this would be more human friendly and self understanting than current paradigm that use "Not" in parameter name with opposite value to achieve the same... which is not natural meaning and "force on the brain"
If you want to ommit parameters in calling fuction it could be defined with a default value in function definition to clarify what default behaviour processing is expected... I would suggest not to sort by default unless explicitly requested (when all items have been added or user request only) eg:
addItems: function(aItemArray, aSort=false) {
(...)
if (aSort) {
this.sortItems();
} else {
this.calculateIndexMap();
}
},
Instead of...
addItems: function(aItemArray, aDontSort) {
(...)
if (aDontSort) {
this.calculateIndexMap();
} else {
this.sortItems();
}
},j
Note the code change within the function to accomodate the change in parameter name and value.
This also mean parameter shall be updated accordingly where ever there is a function call to addItems function...
Just a suggestion...
Assignee | ||
Comment 47•6 years ago
|
||
Progress so far... managed to...
-
Fixed my debugger issues
Turned out I had to update my breakpoints as source code had changed my previously set breakpoints were no longer valid (offset by few lines up or down therefore not being triggered in some cases) all ok after moving them back (clear old line - set on new line) to the right line of code. -
Fixed my custom .xpi add-on that would not installed on TB (saying it was incompatible) at first
That is because I was zipping back the folder and not only its content (this helped me to figure it out https://stackoverflow.com/questions/19240653/how-to-create-xpi-file-with-7zip) -
Setup environment with custom extension, for further testing/troubleshooting to debug issue at will
Created a separate TB profile with no email and just one network calendar with thousands items. This allow to setup custom add-on just for that profile (add-on are indeed installed in each profile even the default TB.lightning one), this way my production profile is unaffected while I can test, troubleshoot and debug possible fix(es) at will using Task Manager monitoring and TB Debugger.
Findings so far...
-
TB beta3 seems better at "multi-processing" so the "not responding" warning appears less at first but UI do slow down or remain mostly unavailable (or available but with major delay) which may now allow to apply the workaround quickly after startup when issue occurs (if you are patient to click and wait long seconds before action occurs in a UI) in case it was not applied before closing the application previously... but still very slow to load...
-
The previous patch provided (patch.v01) fixes only partially the issue observed but not entirely.
-
Some gaps remain between the network requests (pics)... but I may found other root cause (too many repetitive calls to calculateIndexMap() same issue as for sorting) and solution, preliminary tests are promising as I managed to remove gap (delay) which cut loading time by half from the first patch... need to test further...
-
While troubleshooting, I found an additional issue, I did observed before but haven't got a chance to look at, where when all network data is loaded in calendar view (fully loaded) all items suddenly disappear from calendar view (seems happening during or just before final sorting of the unifinder tree view) before they all re-appear again at once...
All this means the patch might be a bit more consequent than first foreseen... and may require extra troubleshooting/testing...
Assignee | ||
Comment 48•6 years ago
|
||
FYI only, no need to review yet... a patch.v03 is coming up...
Assignee | ||
Comment 49•6 years ago
|
||
While waiting here are some statistics...
Network calendar (with ~4000 items) loading time comparison [TB 66.0b3 (32-bit) on Win10Pro64]:
-
with no patch (current upstream code)
==> ~2600+ seconds [43+ minutes] to load calendar in full - TB Not Responding most of the time during loading -
with patch.v01 (no SortItems upon add)
==> ~170 seconds [2 minutes 50] (x15 time faster than upstream) to load calendar in full
--> Preventing sorting [sortItems()] on each item added (do sort only after last item is added) fixes the "Not Responding" UI and the Warning Unresponsibe script: resource://calendar/modules/utils/calUnifinderUtils.jsm:110 -
with patch.v02 (no CalculateIndexMap upon add on top of no SortItems upon add - patch.v01)
==> ~68 seconds [1 minutes 8] (x38 time faster than upstream) to load calendar in full
--> Preventing re-indexing [calculateIndexMap()] on each item added (do indexing once after sorting by call from sort function) fixes remaining gaps/delay between network requests (pics) and allow to get stream of data much faster...
What a difference!!!
Assignee | ||
Comment 50•6 years ago
|
||
Find attached patch.V03 replacing the two previous patches submitted.
Please review and include in next beta and stable as well as backport in current stable via a fix update in measure of possible.
Let me know what you think. I tried to keep it as simple as possible.
- with patch.v03 (sortItems only upon onLoad or setItems - will trigger calculateIndexMap() in the process)
==> ~68 seconds [1 minutes 8] (x38 time faster than upstream) to load calendar in full
--> Preventing sorting and re-indexing [calculateIndexMap()] on each addItem (do sorting only upon onLoad or setItems - indexing being triggered automatically once after sorting - function call in sortItems) fixes remaining gaps/delay between network requests (pics) and allow to get stream of data much faster...
==> No more gap/delay between network requests
Note1: Next step would be to look are reducing the number of network request by increasing batch size (or have it automatically adjusted depending on number of items and bandwidth speed) but that would be dealt with in a separate bug...
Note2: During troubleshooting of this bug, I observed that when Find Events > All Events is set, when clicking on a recurring event in the calendar view (e.g Month view), it does not appear selected in the Find Events list view. While it works find when other Find Events views (select options) are selected e.g Find Events > Events in Current View (or others). This issue only happens for recurring events. This issue is also happening in current stable version of TB so not linked to patch.V03 proposed for review.
==> shall be dealt with in a separate bug... later on...
Assignee | ||
Comment 51•6 years ago
|
||
FYI, patch.v03 proposed in previous message was generated from upstream code as available in extension Lighting 6.9 (10 April 2019) {e2fda1a4-762b-4020-b5ad-a41df1933103}.xpi copied from Thunderbird 67.0b1 (32-bit).
Comment 52•6 years ago
|
||
Updated•6 years ago
|
Comment 53•6 years ago
|
||
Assignee | ||
Comment 54•6 years ago
|
||
(In reply to Geoff Lankow (:darktrojan) from comment #53)
This seems fine at face value (minus the formatting nits) although I've only
done some light testing. I'd appreciate more lines of context (use -U8 when
calling diff) but as it's a first patch I'll let you off. ;-)
Considering all the work done and time spent to fix this issue I would not expect less, but I took note of your relevant comments ;-) A "thank you" would have been an appreciated plus!
Please fix formatting as you see fit to include patch... as you see fit...
Updated•6 years ago
|
Assignee | ||
Comment 55•6 years ago
|
||
(In reply to Richard Leger from comment #50)
Note2: During troubleshooting of this bug, I observed that when Find Events > All Events is set, when clicking on a recurring event in the calendar view (e.g Month view), it does not appear selected in the Find Events list view. While it works find when other Find Events views (select options) are selected e.g Find Events > Events in Current View (or others). This issue only happens for recurring events. This issue is also happening in current stable version of TB so not linked to patch.V03 proposed for review.
==> shall be dealt with in a separate bug... later on...
FYI, Note2 issue has now been reported as a separate Bug 1543716 "When clicking on a recurring event in the calendar view (e.g Month view), event does not appear selected in the Find Events > All Events list view"
Comment 56•6 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/37e43d761fe9
Delay calling unifinderTreeView.sortItems until load event; r=darktrojan
Comment 57•6 years ago
|
||
Congratulations on your first patch landing. And thank you.
Comment 58•6 years ago
|
||
Comment 59•6 years ago
|
||
Assignee | ||
Comment 60•6 years ago
|
||
(In reply to Richard Leger from comment #50)
Note1: Next step would be to look are reducing the number of network request by increasing batch size (or have it automatically adjusted depending on number of items and bandwidth speed) but that would be dealt with in a separate bug...
FYI, Note1 issue has now been reported as a separate Bug 1543953 "Lightning network REPORT request receiving time too high (0.5 to 3 seconds per request) - Loading one ~4000 events network calendar takes more than 1mn - 46 network requests required (isn't it too much?)"
Comment 61•6 years ago
|
||
Comment 62•6 years ago
|
||
Richard, congrats on the persistence and results. So this is a regression that started in version 60? Or, it existed for a long time but something in newer Thunderbird/calendar just made the effects worse? And do we know why?
Definitely good enough reason to do a beta.
Assignee | ||
Comment 63•6 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #62)
So this is a regression that started in version 60?
I don't think this is a regression. I believe that is a bug that "always" been there for years and that was affecting mostly people like me that have thousands of objects in their calendars and that connect to multiple network calendars. We most end-up having to keep most calendar disabled but one or two max to avoid most of the delay startup issues. And then enabling calendar "on demand"... and disable it afterwards to avoid performance issues...
With Lightning extension enabled, TB has ALWAYS been slow to start... this slowness was reported way back by multiple users... I can detect some of the code removed by my patch, already being present in 2010 code repository... e.g https://hg.mozilla.org/comm-central/rev/265623017726 so I don't see when exactly it was introduced...
It just became worse later on with the arrival of 60 stable version I believe or some previous version... not exactly sure which one...
I remember discussions about having Lightning added by default with TB as "core" feature where people argue on one hand that would slow down TB and would rather have it left separate as an extension to add by end-users, or on the other hand to have it in TB by default so issues could be detected/fixed more quickly as more testing before delivery would occur (also keeping TB version in line with Lightning version to avoid incompatibilities). Really an old debate this one probably around TB version 24 from memory :-) The later happened Lightning was integrated by default, but the performance issues with it never been really addressed as it should have... from a user point of view.
Or, it existed for a long time but something in newer Thunderbird/calendar just made the effects worse?
I believe this to be the case... and it has gone worth about two years ago as a rough estimate... when discussion raised about Thunderbird future and possible handover for maintenance to another organisation but it never happened while this lengthy situation had a drastic impact on TB performance as maintenance reduced at the time to sort pressing issue like crashes :-)
Hard to tell which of Thunderbird or Calendar introduced code caused the worsening effect... could be one or the other or both combined... but as I say, the issue was a bug by design that was lying there for a very long time (repeating sorting on every added items in an ever increasing dataset!) both team TB Core and Lightning thinking issue was not in their code possibly :-)
I think Lightning performance (and TB) in general shall be addressed in priority... but no one seems to have time to look into it, at least in Lightning... this bug is a clear example of the situation... despite TB hiring new paid engineers recently, probably working on more pressing/fancy issues :-)
More likely also because it is a boring and time consuming job to track-down performance issues, as opposed to adding new features which may be more interesting from a development point of view :-) and also lack of time/resources/interest/priority on the Lightning performance issues... it is also quite a complex machinery which is not easy to fix...
And do we know why?
I would not really know nor be able to tell... Probably since efforts started to make Thunderbird more "multi-processing" by "time sharing" the processing power of Thunderbird between various part of the app features... causing the sortItems() function to take much much more time to complete than previously... as it pause and resume as processing power is pre-empted and become available to it again perhaps... or merge of new feature from Firefox/TB core code... those are pure speculations but may give a hint on what could have possibly be the aggravating factor in this bug...
Thank you to all the developers that works on TB and Lightning, I use them both everyday and I really appreciate all the work you have done and continue to do to help improve, sort issues and add new features!
Assignee | ||
Comment 64•6 years ago
|
||
(In reply to Richard Leger from comment #63)
I believe that is a bug that "always" been there for years
Possibly present since 11 years (day 1?) according to this bug 441710 report...
Comment 65•6 years ago
|
||
Could this change have regressed Bug 1545042?
Assignee | ||
Comment 66•6 years ago
|
||
Not impossible but would need to be demonstrated... It would be good if anyone else out their is able to test and confirm...
But during my testing with TB 67.0b1, LT 6.9, patch.v03 I haven't observed such issues... though I don't do drag and drop events... which is managed by the calendar UI object, not the unifinder.js which was patch here... but add/edit/delete worked fine at my end via unifinder or calendar UI objects... the sortItems (and calculateIndexMap()) would in any case be triggered via the unifinder setItems function which is used/triggered I believe during save following editing...
The drag and drop would occur on the calendar UI object interface so maybe it is not doing the right thing in version 7.x? e.g not calling the right functions any longer perhaps?
Other changes in LT 7.x could be the route cause of the issue as well potentially...
Assignee | ||
Comment 67•6 years ago
|
||
(In reply to Richard Leger from comment #66)
But during my testing with TB 67.0b1, LT 6.9, patch.v03 I haven't observed such issues...
FYI I have just tested again following instructions in Bug 1545042 and cannot reproduce the issue with TB 67.0b1 and LT 6.9 manually patched with my submitted patch.v03...
Updated•6 years ago
|
Comment 68•6 years ago
|
||
You're sure you want this in the beta given the regression it caused. Skipping this for now.
Comment 69•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Comment 70•6 years ago
•
|
||
Well instead of reverting back (easy non-solution), if someone encountering the regression could try to look at why it is happening and identify what may be the root cause and identify a possible fix (painful solution) that would be a greater option.
Because removing patch means intentionally reverting back to awful TB performance that have been plaguing end-users for about 11 years! Now may be a right moment to look into it and have it fixed...
Perhaps could be an issue related to the offline cache feature... as it is activated by default but I don't use it... (disable it manually)... just a hint...
Comment 71•6 years ago
|
||
We have roughly two weeks to solve bug 1545042 before needing to back this out when beta 68 rolls out
Comment 72•6 years ago
|
||
If the patch has a major known regression and a fix cannot be found within a few days I'd prefer to back it out. We can re-land when the regression is resolved. Jörg, can you handle the backout?
Updated•6 years ago
|
Comment 73•6 years ago
|
||
Sure, it's on my radar, but I'll leave the NI for now. Certainly it should be backed out before we go to TB 68 beta, see comment #71. Best to leave it FIXED for now and make it REOPENED when the backout actually happens.
Personally I'm puzzled by this: It's a pretty small patch (with apparently a big positive effect) and a very clear regression. Shouldn't it be possible to fix the regression? Generally the Mozilla approach is not to back things out, but to properly fix regressions. I don't always agree with that, but here we should make some effort.
Assignee | ||
Comment 74•6 years ago
|
||
I suggested a possible test in Bug 1545042 Comment 16 that may help trying to narrow down the issue, if someone running a daily build would be able to give it a try... this could help identify if regression is due to additional code introduced in TB or LT since last beta... conflicting with the patch.v03 applied.
Assignee | ||
Comment 75•6 years ago
|
||
There are actually two regressions:
- Bug 1545042 (more likely a view refresh issue - fixed by switching between two unifinder views - selection box)
- Performance issues as per statistics test results available in Bug 1545042 Comment 21
I am still convinced that none of those regressions are due to patch.v03 which in any case bring much improvements in term of performance compared without it.
The regressions observed while possibly triggered somehow by patch.v03 are not due to it, but more likely due to the numerous other changes that occurred in Lightning as highlighted in Bug 1545042 Comment 20 (diff available between LT 6.9 and LT 7.0a1 as available from 20190412 which is when issue started to be observed).
Comment 76•6 years ago
|
||
Backed out on request of Philipp, the Calendar module owner.
https://hg.mozilla.org/comm-central/rev/91691e44548ba1784aa7b5c37bc1704078785cc7
Backed out changeset 37e43d761fe9 (bug 1502923) for causing problems in unifinder (bug 1545042) a=backout DONTBUILD
Sadly no one stepped up to the challenge to fix bug 1545042. Before backing this out I have verified manually that the backout fixes bug 1545042.
Comment 77•5 years ago
|
||
So do you guys think this issue is at all sounding like what's happening in bug 1509739 or bug 1522990? The part about disabling Lightning and everything works seems quite similar. The fix seems to be to start use a new profile.
Richard, is this something you'd be willing to try and confirm as per what is stated in https://bugzilla.mozilla.org/show_bug.cgi?id=1509739#c4 and https://bugzilla.mozilla.org/show_bug.cgi?id=1513202#c6 ?
Assignee | ||
Comment 78•5 years ago
|
||
(In reply to Arthur K. from comment #77)
The fix seems to be to start use a new profile.
All the findings in this bug report shall clearly indicate that the fix has nothing to do with using a new profile... a patch was issued to fix it but a regression raised in 68.x branch due to too many other changes in the code... so patch was backed out... the performance issues lies within Lightning code... currently not optimised for performance especially when use with large calendars (with ~4000 items or more) and multiple of them!!!
Until someone from the Lightning development teams get time to look seriously into it, and make it a priority, it can be fixed, but until then... I am afraid there is nothing else that can be done about it... we can only wait for someone to look into it... and have it fixed... I tried... it failed miserably because without time, support and effort from the development team to tackle performance issue in Lightning there is nothing we can do about it to have it fixed :-)
Sad but true.
Comment 79•5 years ago
|
||
I was hoping that there might have been some correlation between this bug and the others but oh well. Yes, I can see that with large amounts of cal items, it would probably bog down as it's going out and parsing or retrieving those multitude of events. And this is with future cal items, not those those that have passed right?
One question: Google's calendars are set up such that when an event passes, they'll still stay in your calendar(s) ad infinitum. Is there a means or mechanism in TB by which old cal events which are or would likely be no longer needed could be purged out in the same way that the old POP3 setting to "remove mail from server after "x" days" could be implemented? Meaning, if an event is "x" days old, just remove it from the calendar so it's not just sitting there rotting uselessly? I would think such a setting to purge events which have passed but are still being stored might help a bit in reducing the overall events needing to be parsed?
Assignee | ||
Comment 80•5 years ago
|
||
(In reply to Arthur K. from comment #77)
So do you guys think this issue is at all sounding like what's happening in bug 1509739 or bug 1522990? The part about disabling Lightning and everything works seems quite similar.
bug 1509739 is likely to be a duplicate of this bug
bug 1522990 is unlikely to be a duplicate of this bug though may be related somehow...
The fix seems to be to start use a new profile.
Not the fix. Better try to make sure that in the Calendar view > Find Event area you choose something like "Currently Selected Day" instead of "All Events" in the selection box prior restarting TB. This is not a fix but a workaround to minimise the issue. Long term fix still to be determined and implemented...
Assignee | ||
Comment 81•5 years ago
|
||
(In reply to Arthur K. from comment #79)
I was hoping that there might have been some correlation between this bug and the others but oh well.
There might to some extent.
Yes, I can see that with large amounts of cal items, it would probably bog down as it's going out and parsing or retrieving those multitude of events. And this is with future cal items, not those those that have passed right?
Currently Lightning load all items past, present, future... for all calendars... I would expect to be relevant for end-users to have access to all items of all calendars past, present, future as a default feature, that seems to be the correct things to do... now how and when such items are loaded in TB and the views is another matter :-)
A full calendar of ~4000 items takes about 1sec to load in one go on an ADSL connection which is nothing really via web browser... the problem is not the number of items in the calendar... the issue is linked to flaws in Lightning code and design that is not optimised to handle multiple CalDav calendars containing thousands of items each, coupled with this bug in the code that cause exponentials sorting of all items for each items added to TB that still need fixing?!
One question: Google's calendars are set up such that when an event passes, they'll still stay in your calendar(s) ad infinitum.
Well that is the expected behaviour of a calendar... to allow you to keep historic of events by default.
Some calendar system may allow to "program" auto-deletion of items (behind time range, within a specific type, etc...) but CalDav protocol and Thunderbird do not allow to do so to my knowledge.
While this could be considered as a new feature, it shall not be considered as a solution for this bug.
It would be much better to fix and optimise Lightning code to allow handling of multiple large CalDav calendars with thousand of items each... which is (and should be considered as) a common use case... that Lightning code shall be tested regularly against, in term of performance...
Is there a means or mechanism in TB by which old cal events which are or would likely be no longer needed could be purged out in the same way that the old POP3 setting to "remove mail from server after "x" days" could be implemented?
I am not aware of any such mechanism in TB... or in CalDav protocol...
Meaning, if an event is "x" days old, just remove it from the calendar so it's not just sitting there rotting uselessly?
You can already delete one or more of such items manually quite easily already...
Auto-deleting old items could be a feature handy for some users, but majority of end-users may want to keep historic of ALL their events and they should be able to do so. Again deleting items shall not be considered as a solution to the problem here... which is a performance issue, though it could be considered as an added feature but not directly linked to this bug or related.
Lightning should be perfectly capable of handling thousand of events (TB does with emails)... most today's computer resources would allow it to do so without a itch...
But code (re)design review and refactoring would be required to handle event items in batch instead of individually and initials setup of calendar loading could be processed in a different way... to optimise and improve performance and loading speed...
I would think such a setting to purge events which have passed but are still being stored might help a bit in reducing the overall events needing to be parsed?
To my point of view, the problem is not the quantity of event being parsed that is the root cause of current performance issue, though it contribute to it, TB for example is able to handle thousand of emails via IMAP or other protocol so Lightning shall be able to handle thousands of event items without issue...
Lightning current design is buggy, and is just not optimised for handling high volume of events in batch or for optimised performance... especially in the various views... also some bug in the code may increase performance issues at the moment... I suspect also Lightning code is not tested/optimised to run with multiple CalDav calendars with thousand of items each on low speed connection (e.g ADSL).
Until the Lightning dev team review and tackle this bug as well as long lasting performance issues, there is not much end-users (as I am) can do to fix them but to use workaround as available to them where applicable... or wait for someone some day to look at it and fix it. The sooner the better for all of us, but it has been going on for years already :-)
I tried via this bug, but it did not workout...
Assignee | ||
Comment 82•5 years ago
|
||
Also, this Bug 1502923 is about Lightning bug that cause exponential sorting of all items for each item added at startup (first loading)... but there are other reasons of poor startup performance such as Bug 543953 "Lightning network REPORT request receiving time too high (0.5 to 3 seconds per request) - Loading one ~4000 events network calendar takes more than 1 minute - 46 network requests required (isn't it too much?)" ... this is only another example among possible others...
Those are just the tip of the iceberg... hopefully all will be uncovered and tackled one day... starting with those two...
Assignee | ||
Comment 83•5 years ago
|
||
(In reply to Richard Leger from comment #82)
such as Bug 543953
Sorry I made a typo in my previous message...
I meant bug Bug 1543953 "Lightning network REPORT request receiving time too high (0.5 to 3 seconds per request) - Loading one ~4000 events network calendar takes more than 1 minute - 46 network requests required (isn't it too much?)"
Updated•5 years ago
|
Assignee | ||
Comment 84•5 years ago
|
||
This bug may be blocked by Bug 1567055 "Add items to the unifinder list more efficiently"
Assignee | ||
Comment 85•5 years ago
|
||
Updated Ligthning CalDAV performance test results are available in Bug 1567055 Comment 12.
It includes test results for TB Nightly 70.0a1 (2019-07-26 08-35-20) as well comparison to watch progression of performance improvements.
Assignee | ||
Comment 86•5 years ago
|
||
(In reply to Richard Leger from comment #85)
Updated Ligthning CalDAV performance test results are available in Bug 1567055 Comment 12.
It includes test results for TB Nightly 70.0a1 (2019-07-26 08-35-20) as well comparison to watch progression of performance improvements.
Copying test results here for the record. This may allow monitoring future progress within this bug as Bug 1567055 is now closed.
For more details on context and setup that lead to those results, consult Bug 1567055 Comment 12.
Loading performance of one Caldav calendar with ~4000 items over ADSL connection:
Without sorting - Find Event View (unifinder) -> keep selectedColumn=false (default - no particular sorting)
# | TB Version | LoadingTime*(Disappearance**) | DevTools > Networking |
---|---|---|---|
01 | 60.8.0 (32-bit) ESR | ~6m23s (50s) | 48 requests - 7.98MB transferred - Finish: 7m65s |
05 | 66.0b3 (32-bit) Beta with patch.v3*** | Not available | Not available |
02 | 68.0b5 (32-bit) Beta | ~3m34s (14s) | 45 requests - 7.97MB transferred - 3m71s |
07 | 70.0a1 (2019-07-26 08-35-20) (32-bit)**** | ~4m59s (15s) | 45 requests - 7.97MB transferred - 4m86s |
With sorting - Find Event View (unifinder) -> keep selectedColumn=true (Title column selected by end-user for sorting)
# | TB Version | LoadingTime*(Disappearance**) | DevTools > Networking |
---|---|---|---|
03 | 60.8.0 (32-bit) ESR | more than 100m (unknown) | more than 61 requests - more than 12.33MB transferred - Finish more than: 101m76s |
06 | 66.0b3 (32-bit) Beta with patch.v3*** | ~68s (unknown) | (unknown) |
04 | 68.0b5 (32-bit) Beta | ~47m48s (15s) | 56 requests - 10.33MB transferred - 47m02s |
08 | 70.0a1 (2019-07-26 08-35-20) (32-bit)**** | ~8m58s (1m03s) | 45 requests - 7.97MB transferred - 7m79s |
Comment 87•5 years ago
|
||
(In reply to Richard Leger from comment #86)
(In reply to Richard Leger from comment #85)
Updated Ligthning CalDAV performance test results are available in Bug 1567055 Comment 12.
It includes test results for TB Nightly 70.0a1 (2019-07-26 08-35-20) as well comparison to watch progression of performance improvements.Copying test results here for the record. This may allow monitoring future progress within this bug as Bug 1567055 is now closed.
For more details on context and setup that lead to those results, consult Bug 1567055 Comment 12.Loading performance of one Caldav calendar with ~4000 items over ADSL connection:
Without sorting - Find Event View (unifinder) -> keep selectedColumn=false (default - no particular sorting)
# TB Version LoadingTime*(Disappearance**) DevTools > Networking 01 60.8.0 (32-bit) ESR ~6m23s (50s) 48 requests - 7.98MB transferred - Finish: 7m65s 05 66.0b3 (32-bit) Beta with patch.v3*** Not available Not available 02 68.0b5 (32-bit) Beta ~3m34s (14s) 45 requests - 7.97MB transferred - 3m71s 07 70.0a1 (2019-07-26 08-35-20) (32-bit)**** ~4m59s (15s) 45 requests - 7.97MB transferred - 4m86s With sorting - Find Event View (unifinder) -> keep selectedColumn=true (Title column selected by end-user for sorting)
# TB Version LoadingTime*(Disappearance**) DevTools > Networking 03 60.8.0 (32-bit) ESR more than 100m (unknown) more than 61 requests - more than 12.33MB transferred - Finish more than: 101m76s 06 66.0b3 (32-bit) Beta with patch.v3*** ~68s (unknown) (unknown) 04 68.0b5 (32-bit) Beta ~47m48s (15s) 56 requests - 10.33MB transferred - 47m02s 08 70.0a1 (2019-07-26 08-35-20) (32-bit)**** ~8m58s (1m03s) 45 requests - 7.97MB transferred - 7m79s
Not sure if it would make much difference but could you also test with 69.0b?
Assignee | ||
Comment 88•5 years ago
|
||
(In reply to Arthur K. from comment #87)
Not sure if it would make much difference but could you also test with 69.0b?
Here are additional tests and results...
ADSL - All Events - No sorting
# | TB Version | LoadingTime*(Disappearance**) | DevTools > Networking |
---|---|---|---|
09 | 69.0b1 (32-bit) | ~2m59s (10s) | 60 requests - 8.46MB - 3m07s |
ADSL - All Events - Sorting by Title
# | TB Version | LoadingTime*(Disappearance**) | DevTools > Networking |
---|---|---|---|
10 | 69.0b1 (32-bit) | ~54m16s (14s) | 61 requests - 10.29MB - 54mn32s |
Note about test 10: Toward the end about 10 last minutes there seems to be a continuous network traffic between ~3.5MB with picks at 7.7MB some time to time as observed in Task Manager > Performance > Wifi graph
... and for the sake of comparison ...
Lease Line ~30Mbps - All Events - Sorting by Title
# | TB Version | LoadingTime*(Disappearance**) | DevTools > Networking |
---|---|---|---|
11 | 70.0a1 (2019-07-26 08-35-20) (32-bit) | ~8m54s (49s) | 45 request - 7.97MB - 8m05s |
Note about test 11: This last test just shows that higher network speed does not improve performance...
Assignee | ||
Comment 89•5 years ago
|
||
To the risk of repeating myself, my view on this performance issue exposed here remain that:
- It is linked to the calendar unfinder additem function
- It is already fixable "today" with a little bit of work and effort (I tried...)
The additem function is called for each item added to the unfinder tree therefore this function/definition shall be kept to the minimum, it should only be used for one thing: adding one item to the tree when it is called (or a batch of items if that is the future plan which may be even more efficient but I would keep that for later :-)
The rest such as sorting and map indexing shall ideally happen outside this function once all items would have been added or happens only once the last item is added (full tree loaded). In the eventuality items are added by batch, sorting and indexing shall happen once all batch have been added (loading of all items has completed)... I think that is the purpose of the onload function to detect such event...
If indexing map is still required within additem (it may be required as other view may use the same map to deal with events during loading perhaps not sure how the map works or what it is used for), then it should happen on the fly, without requiring parsing of the overall tree for each item added as done currently by calling this.calculateIndexMap(); within additem function. The sort function would in any case trigger the re-mapping following sorting... so that may just be a matter of putting the sorting function in the right place and to trigger it once all items would have been loaded (if a column is not selected if would not sort anyway, but would still trigger the re-mapping so it get covered). Yes items would be unsorted for the time of loading but really who cares as far as performance are there and items are sorted at the end of loading... In any case during loading it is not possible to interact with the calendar items currently... interface not responding... that is why it is essential it loads as fast as possible...
Sorting and mapping as currently done within additem function is the root cause of performance issue as highlighted by patch.v3 in this bug... simply because both of those actions parse the entire tree, and are done repeatedly for each item added (this to me is the design flow causing perf issue) so e.g 4000 time sorting and remapping of the entire tree (ever growing as items are added) for a calendar containing 4000 items (subject that All Events is selected in unifinder) and that is just assuming only one calendar is setup in TB! Which is the case for test results in previous comments... so imagine when you are connected to 3,4 or 5 calendars what happens!!!
Looking at Bug 1567055 and its related patch modifying the additem function, it does not seems that is the approach taken by developers sadly... meaning the performance issue exposed here would remain... for now... and next ESR... let see and wait on future progress... in fixing what is a design flaw causing huge performance issue...
Assignee | ||
Comment 90•5 years ago
|
||
The attached patch bug1502923.patch.v04.txt is similar to the previous one submitted but applicable to TB/Lightning version 69.0b1.
It bring a huge performance gain by dropping the calDAV calendar initial loading time from ~54m16s to ~1m26s in TB 69.0b1. See test result below...
ADSL - All Events - Sorting by Title [No sort & No index map in calendar-unifinder.js > additems function - just adding items :-)]
# | TB Version | LoadingTime*(Disappearance**) | DevTools > Networking |
---|---|---|---|
17 | 69.0b1 (32-bit) with bug1502923.patch.v04 | ~1m26s (13s) | 45 request - 8MB transferred - Finish: 1m30s |
Notes:
-
The list of items in unifinder appears sorted at the end of the loading as expected. Manual sorting takes only 1sec to 2sec in the UI. So doing it at the end of loading is not a huge issue considering it take more than a 1mn to load the calendar still...
-
No more gaps appear between network requests, the network graphs (task manager > performance > wifi) looks like this
/\/\/\/\/\...
(instead of/\_/\__/\___/\...
without patch, native code) this means the speed of loading is now only limited by the network requests processing/speed... -
May be worth checking that this patch do not cause regression as observed in 68 branch previously but I have not noticed any in my basic multiple tests (modify existing event, add, modify,remove,move events in unifinder and calendar week view) so far.
-- If anyone bother to test this patch and has a reproducible use case of regression, please provide info on your current environment e.g your calendar and unifinder settings (caldav calendar option settings, selected view, selected column, etc...) and UI steps to reproduce the issue.
Comment 91•5 years ago
|
||
Is that not functionally the same change we already landed and backed out? It may solve your case but addItems
is also called through other code paths.
I have a patch which achieves the same thing without breaking addItems
.
Comment 92•5 years ago
|
||
This depends on bug 1571336, in the case of calDAV.
Assignee | ||
Comment 93•5 years ago
|
||
Hi Geoff,
(In reply to Geoff Lankow (:darktrojan) from comment #92)
Created attachment 9082937 [details] [diff] [review]
1502923-unifinder-refresh-1.diffThis depends on bug 1571336, in the case of calDAV.
Which version of TB your patch can be applied to? 69.0b1?
Is it to be applied in addition of my patch, or instead?
Does it also require to apply patch as found in bug 1571336 as you seems to indicate it depends on it?
Cheers,
Assignee | ||
Comment 94•5 years ago
|
||
Find attached TB 70.0a1(2019-07-30) > DevTools > Performance > Call Tree while loading CalDAV calendar with ~4000 items (about 25 network requests through out of 45) following publication of patch from Bug 1567055.
This highlight huge performance impact due to unifinder addItems function calls to:
- calculateIndexMap
- findIndex & map (required for splicing)
Assignee | ||
Comment 95•5 years ago
|
||
Tests
Performance tests below follow publication of patch from Bug 1567055, which applies to TB 70.0a1 (2019-07-30) (32-bit), to evaluate its performance impact...
Various patches (in attachment) were applied to run the tests to successively disable sortItems, calculateIndexMap, sortItems&calculateIndexMap (both), sortItems&calculateIndexMap&splicing (all three, just add items)... to highlight how performance progresses...
ADSL - All Events - Sorting by Title - with various patching tests
# | TB Version | LoadingTime(Disappearance) | DevTools > Networking |
---|---|---|---|
12 | 70.0a1(2019-07-30) Native code | ~7m67s (24s) | 45 Requests - 7.99MB Transferred - Finish: 7mn44s |
13 | 70.0a1(2019-07-30) patch.v05.noSortItems in addItems | ~8m12s (20s) | 45 Requests - 7.99MB Transferred - Finish: 7mn73s |
14 | 70.0a1(2019-07-30) patch.v06.noCalculateIndexMap in addItems | ~6m07s (24s) | 52 Requests - 8.54MB Transferred - Finish: 5mn93s |
15 | 70.0a1(2019-07-30) patch.v07.noSortItems&noCalculateIndexMap in addItems | ~5m50s (20s) | 45 Requests - 7.99MB Transferred - Finish: 5mn41s |
16 | 70.0a1(2019-07-30) patch.v08.noSortItems&noCalculateIndexMap&noSplicing.justAddItems | ~2m23s (25s) | 48 Requests - 8.54MB Transferred - Finish: 2mn17s |
Assignee | ||
Comment 96•5 years ago
|
||
Hi Geoff,
(In reply to Geoff Lankow (:darktrojan) from comment #91)
Is that not functionally the same change we already landed and backed out? It may solve your case but
addItems
is also called through other code paths.
Yes, it is the same patch but applied to a different version of TB.
I have a patch which achieves the same thing without breaking
addItems
.
Have you noticed the regression? I can't from my side somehow... I may not be doing what you are doing to see it, nor having the same settings as you perhaps... If you could precise how you get the regression, if you do, I could look into it to help sorting it out.
I suspect it is related to the mapIndex... but I believe this could be populated on the fly for the added item (I will come with a proposal later, shall I do it in Bug 1567055?)... without parsing the all try over and over again... each time to remap all items for each item added!
Clearly my patch and testings continue to show that from a performance point of view, the addItem function shall not make any calls to sortItems, calculateMapIndex nor any map of findIndex functions... as those have a huge impact on performance batch or no batch processing... I know you intend to add more than one item at a time in the feature via batch processing (as opposed to one-by-one item currently) which is a good thing, but that would not sort the all the performance issue observed, just reduce them slightly...
If addItems is "broken" somehow by my patch because called from somewhere else (that I may have not tested somehow), it may be worth to look into it considering the performance gain of my patch (only limited by the network requests traffic)... to analyse and find the root cause of regression... and fix it... don't you think?
This does no prevent to add batch processing feature, as you do, which would also improve the performance certainly, but it could be worked out both ways together... to fix all performance issues observed not just part of it...
I am trying to help here... let me know how I can do it better to help you... fix all performance issues... that I can see... to the benefit of everyone!
Cheers,
Comment 97•5 years ago
|
||
(In reply to Richard Leger from comment #96)
I am trying to help here... let me know how I can do it better to help you... fix all performance issues... that I can see... to the benefit of everyone!
Thanks much for investing your time on this bug and your patches. Although I'm a user, not a dev, getting to the heart of the problem will certainly help users who've experienced this issue. I know TB doesn't have the manpower to fix everything like FF, every little bit helps.
Assignee | ||
Comment 98•5 years ago
|
||
Statistics - Number of times code blocks and functions are called in unifinder addItems function
FYI, find below some statistics following publication of patch from Bug 1567055 (https://hg.mozilla.org/comm-central/rev/3a098643e080), which applies to TB 70.0a1 (2019-07-30) (32-bit).
They were established, by applying bug1502923.stats.v01 (in attachment) to TB 70.0a1 (2019-07-30) (32-bit), to know how many time code blocks and functions are called within the unifinder addItems function when loading a calDAV calendar containing about ~4000 items...
This was done to get an idea:
- how new code works currently...
- how code design impact performance...
ADSL - All Events - No Sorting
addItems: 3837
append: 3837
sortItems: 0
rowCountChanged: 3837
newPosition (this.eventArray.map): 0
forLoops (values.findIndex): 0
push: 0
splice: 0
calculateIndexMap: 3837
ADSL - All Events - Sorting by Title
addItems: 3937
append: 1
sortItems: 1
rowCountChanged: 0
newPosition (this.eventArray.map): 3936
forLoops (values.findIndex): 3936
push: 3
splice: 3933
calculateIndexMap: 3937
Notes
About addItems
- Currently items are still added one-by-one for now. So we get about ~4000 calls to addItems function.
About sortItems
-
sortItems is called only once (calendar-unifinder.js:456) when addItems is first called and only if selectedColumn is enabled, but there are no items in the unifinder view at this point in time, so it appears useless to call it, unnecessary call?
-
Especially considering sortItems is already called every time outside addItems function at the end of unifinder loading via: refreshTreeInternalFunc (calendar-unifinder.js:911) > addItemsFromCompositeCalendarInternal (calendar-unifinder.js:882) > setItems (calendar-unifinder.js:547) > sortItems (calendar-unifinder.js:574)
It is not very clear why a refresh of the tree would cause setItems to be called (and therefore sortItems) after the unifinder is fully loaded... but at least this seems to confirm again my suspicions that:
- sortItems is called multiple times while it should be called only once
- sortItems has nothing to do in the addItems function :-)
About newPosition (this.eventArray.map)
- Working out new position of each items requires call to this.eventArray.map ~4000 times! Is that necessary? It has a huge performance impact.
About forLoops (values.findIndex)
- The for loops trigger call to this.eventArray.map ~4000 times! Is that necessary? It has a huge performance impact.
About calculateIndexMap
-
calculateIndexMap function keep being called every time an item is added (so it means ~4000 times) and this continue to cause huge performance loss.
-
calculateIndexMap function would either need to be called only once, after unifinder has full loaded (all items added) which is already the case via sortItems, or index mapping to occur on the fly for the item added without having to reparse the entire tree each time (which is what it does every time caclulateIndexmap function is called, looping trough all items available in the tree).
-
calculateIndexMap function is called via sortItems outside addItems in any case (but perhaps not when no column are selected), so this function may still not need to be present in addItems...
Hope that helps bring some new clarity via a different angle on the performance matter :-)
Assignee | ||
Comment 99•5 years ago
|
||
(In reply to Richard Leger from comment #98)
About forLoops (values.findIndex)
- The for loops trigger call to this.eventArray.map ~4000 times! Is that necessary? It has a huge performance impact.
CORRECTION, sorry I meant: "The for loops trigger call to values.findIndex ~4000 times! Is that necessary? It has a huge performance impact." in the section above, was bad copy/paste from my part :-(
Comment 100•5 years ago
|
||
Comment 101•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/f52ba6e5e48b
Delay adding and sorting unifinder items until load is complete. r=pmorris
Comment 102•5 years ago
|
||
If this improves the performance, we should consider uplifting it, right?
Comment 103•5 years ago
|
||
Eventually yes, but let's give it some time to see if any problems crawl out of the woodwork.
Comment 104•5 years ago
|
||
(In reply to Geoff Lankow (:darktrojan) from comment #103)
Eventually yes, but let's give it some time to see if any problems crawl out of the woodwork.
I'm inclined to agree, especially since this has been determined to not be a regression there is no urgency, although definitely a good thing for users. The natural progression is give it a week in a few users' hands, then uplift to beta 69 (with hopefully other newly identified issues in 68.0) so it can be proven ready for ESR, which would then probably be 68.1.
Assignee | ||
Comment 105•5 years ago
|
||
Thanks for the patch... I will give it a try and report back on performance improvement it may bring... till then I remain doubtful that this patch address the issues raised in this bug which seem related to the unfinder addItems function... which the patch does not seem to cover... (could the patch have been published in the wrong bug report?)... seems premature to turn this bug as resolved just yet... keep you posted...
Assignee | ||
Comment 106•5 years ago
|
||
Geoff,
Progress but not out of the wood yet...
Can this bug be re-opened as it is still not fixed/resolved yet from an end-user point of view? It would make sense...
With TB Daily 70.0a1 (2019-08-08) (32-bit) which I believe include the patch https://hg.mozilla.org/comm-central/rev/f52ba6e5e48b and other code changes, the ~4000 items CalDAv calendar loads in about 2mn53 which is a much promising and welcome progress... Alléluia & Thank you! Though this loading duration above one minute remains not acceptable from end-user point of view, and I think you would agree...
I have observed a possible regression as when calendar is syncing no items appear in unifinder till the end of loading (with All Events and selected column Title), unfinder remain totally blank so you cannot see any progression of the loading while in the calendar view tab... it looks like nothing is happening... few items appearing in calendar week view... then nothing... till the end where "bang" all items appear at once suddenly in unifinder view!
Also noted, there are still gaps appearing between network requests (data gathering) which indicate delay from Thunderbird processing between the requests, the aim of this bug shall be to remove progressively all such gaps that cause unnecessary loading delay, but this time it is not coming from the addItems function as it seems this function is no longer triggered (a breakpoint set within that function is not triggered at all), is that normal?.
During calendar loading, Thunderbird UI keeps "freezing/lagging" but now the**(Not Responding)** notification is no longer showing up certainly because the delay of responsiveness has fall under a threshold... while its frequency remain regular... Thunderbird is more reactive but still lagging... I am conscious that this issue will not all be fully resolved here, this is just for information.
Hope that help bring progress further... work in progress, well done :-)
Regards,
Comment 107•5 years ago
|
||
I expected there to be no items shown until all were loaded, because that's what the patch did.
We must be stuck on some other slow code now, I wonder what. A new performance profile would be useful now. (You can save a profile as JSON from the developer tools, and then I can load it and look at it more closely than can be done with a screen shot.)
Comment 108•5 years ago
|
||
Doesn't seem to be useful to reopen this. We file followup bugs for related issues and regressions (see new/clone bug below). An improvement landed here, so -> FIXED.
Assignee | ||
Comment 109•5 years ago
|
||
@Geoff,
Will send you json perf profile shortly...
@ Magnus,
(In reply to Magnus Melin [:mkmelin] from comment #108)
Doesn't seem to be useful to reopen this. We file followup bugs for related issues and regressions (see new/clone bug below). An improvement landed here, so -> FIXED.
I understand you eagerness in trying to fix and close this bug, believe me I am the first one to want that to happen among all end-users out there :-)
But I would still suggest to keep that bug open to fix the remaining processing delay in TB due to some remaining slow code that still need to be narrowed down and sort out... to fix the gaps between network requests... that still exists... it is relevant to continue working on it here because it is fundamentally the same issue, because one calDAV calendar still take about 3mn to load via TB (will it take one seconds or two via http), because people interested in performance issues are already following this bug and all the background analysis is contained in it already.
As for the regression, it is less of a concern considering it is "by design" as Geoff seems to confirm and a separate regression/follow up bug can be file for it later on...
The delay and performance issues should be the priority... the team is making headways and we can see light in the tunnel but not there yet... unless it is an oncoming train...
Cheers,
Comment 110•5 years ago
|
||
Closing this has nothing to do with eagerness, it is part of the process. The well understood practice in this bug system, BMO, is one bug per identified code fault. And when a patch has landed for that specific code fault, normally the bug is closed by the patch author, in this case Geoff who is a peer in the calendar module. (peer indicates he understands the code reasonably well)
Comments can continue to be made in closed bugs to gather more information, and spin new bugs spun from the analysis.
But for now the only thing which should cause this bug to be reopened is if Geoff's patch is backed out. So please leave it closed and comment and spin off new bugs as needed.
Comment 111•5 years ago
|
||
Managing uplifts/backports for a bug with multiple patches can become a nightmare. So let's fix more issues in a new bug. Besides, at comment #111 this bug here is becoming confusing.
Assignee | ||
Comment 112•5 years ago
|
||
(In reply to Richard Leger from comment #106)
I have observed a possible regression as when calendar is syncing no items appear in unifinder till the end of loading (...)
A follow up/regression Bug 1572826 has been created to deal with that issue separately...
Also noted, there are still gaps appearing between network requests (data gathering) which indicate delay from Thunderbird processing between the requests, the aim of this bug shall be to remove progressively all such gaps that cause unnecessary loading delay, but this time it is not coming from the addItems function as it seems this function is no longer triggered (a breakpoint set within that function is not triggered at all), is that normal?.
Another follow up Bug 1572823 has been created to deal with this other issue separately...
Sorry, I missed the New/Clone Bug button on my screen so I created them as new bugs already, I don't know if someone can link them to this bug somehow for reference...
Comment 114•5 years ago
|
||
I am still seeing VERY slow response on Thunderbird 71.0b3 (64-bit), with calendar disabled. Other Windows applications (notepad, etc.) all respond pretty much normally, but get a blank screen on Thunderbird, with "unresponsive" in the title bar. It eventually comes back, but is VERY annoying.
Comment 115•5 years ago
|
||
Time to uplift to ESR?
Or is there a strong need to have the two followup bugs in the same go? (both of which are still in unconfirmed status)
- Bug 1572826 - No items appear in unifinder when calDAV network calendar is loading, till complete loading has occurred - no loading progress, looks like nothing is happening - lightning/calendar 70.x [regression]
- Bug 1572823 - calDAV network calendar with ~4000 items takes ~3mn to load - gaps between network requests for data - delay due to Thunderbird processing -lightning/calendar 70.x
Comment 117•5 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #115)
Time to uplift to ESR?
If we did, bug 1479320 and bug 1567055 should go with it, but I am not keen to uplift all of them this late in the cycle. 78 is just around the corner.
Description
•