Testcase generating large number of editable elements is 6x slower in Nightly. The time increases superlinearly with increase in number of element (45x slower with 3x element count)
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: mayankleoboy1, Unassigned)
References
(Depends on 1 open bug)
Details
Attachments
(2 files)
Open attached testcase
Enter 50000 and click on generate
Nightly: https://share.firefox.dev/3WwTJPo (5.4s)
Chrome: https://share.firefox.dev/40N2g3g (0.9s)
Maybe something to improve?
Testcase is generated using chatgpt.
Reporter | ||
Comment 1•22 days ago
|
||
N=150000
Nightly: https://share.firefox.dev/3E4NFqY (135s)
Chrome: https://share.firefox.dev/4audQUj (3s)
Reporter | ||
Comment 2•22 days ago
|
||
Reporter | ||
Updated•22 days ago
|
Reporter | ||
Comment 3•22 days ago
|
||
Hmm, this isnt really content-editable. It is just editable content.
Comment 4•21 days ago
|
||
Looks like checking spellcheck
attr is too slow due to checking ancestors and it may mishit especially in testcases.
Comment 5•21 days ago
|
||
Comment 6•21 days ago
|
||
Should we even spellcheck if the element is not focused?
In a test-case like:
data:text/html,<div contenteditable>foo bar baz</div><div contenteditable autofocus>foo bar baz</div>
Chrome only shows the spellcheck marks on the focused node. That would basically fix this, right?
Comment 7•21 days ago
|
||
Another alternative would be to use SelectNodeContents
rather than SelectNode
. Which should be faster and also work, right?
Reporter | ||
Comment 8•21 days ago
|
||
Surprising to me that this testcase highlights very different things compared to the "input element =text" testcase in bug 1943230
Comment 9•21 days ago
|
||
They use very different code-paths, so not that crazy :)
Comment 10•21 days ago
|
||
Reporter | ||
Comment 11•20 days ago
|
||
The improvements from bug 1943832 are glorious.
150000 elements : https://share.firefox.dev/4gdPiAc (4.1s) !
So from 135s -> 4.1s (32x faster)
Even better, in both the before and after profiles the spellchecking stuff takes ~3s . If you remove that, the after profile takes 971ms!
So 131s -> 971ms (134x faster!!)
Reporter | ||
Comment 12•20 days ago
•
|
||
Here is a partial profile for 10x the testcase 1500000 elements:
https://share.firefox.dev/3PR3nIZ
This is the breakdown:
- Actual generation: 4.8s
- Reflow: 5.3s.
- Spellcheck stuff: 53s (partial)
Anything that can be fixed for the long tail of spellcheck stuff? I can file a new bug if needed.
Else, is there anything more to fix here?
Comment 14•19 days ago
|
||
I think it's worth filing a bug for the spellcheck stuff... At the very least to try to spellcheck less (comment 6), but also there's some low hanging fruilt there (e.g. it seems mRealWords
could benefit from being an AutoTArray
, etc).
Reporter | ||
Updated•19 days ago
|
Updated•15 days ago
|
Reporter | ||
Comment 16•10 days ago
|
||
Partial Profile with 1500000 elements: https://share.firefox.dev/3WNC1HD
(In reply to Mayank Bansal from comment #16)
Partial Profile with 1500000 elements: https://share.firefox.dev/3WNC1HD
Looks like there are only issues of the heavy allocations of the spellchecker. I don't know whether it's reasonable cost or not.
Reporter | ||
Comment 18•2 days ago
|
||
The only dependency is Bug 1944275, which doesnt have a clear path forward. But it can be independently tracked.
I will close this bug as FIXED. Thanks for all the work on this Masayuki and Emilio!
Description
•