Open Bug 1968623 Opened 1 year ago Updated 1 year ago

Testcase inserting N "\n" is 1.8x slower in Firefox (time spent in comparing new value and old value which is required for dispatching change event)

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

Performance Impact none

People

(Reporter: mayankleoboy1, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Open testcase
"Number of empty strings" = 500000
Click on "Insert empty strings"

N=500k
Firefox Samply: https://share.firefox.dev/4jnh4LY (210s)
Chrome: https://share.firefox.dev/43tws3y (117s)
Firefox gecko profiler for 50k: https://share.firefox.dev/3Z2ul5u

Maybe something to improve?

Looks like that it takes a little bit long at comparing new value and old value which is required for dispatching change event later. We've already optimized a lot in the editor module about setting the value around ver. 57. I don't think we can optimize this more in the editor module level.

Putting this into the general perf component.

Component: DOM: Editor → Performance: General
Summary: Testcase inserting N "\n" is 1.8x slower in Firefox. → Testcase inserting N "\n" is 1.8x slower in Firefox (time spent in comparing new value and old value which is required for dispatching change event)

The severity field is not set for this bug.
:bas.schouten, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(bas)

Editor still feels like the right component to me.

Is there an example of a user facing issue resulting from this slowness? If there is please let me know so I can calculate the performance impact, and reset the performance impact flag to request re-triage.

Performance Impact: --- → none
Component: Performance: General → DOM: Editor
Flags: needinfo?(bas)

No, at least there is no bottleneck in the editor module according to the profile.

These are in the DOM module, the former is required to consider whether we should dispatch change event later and the latter is required to sanitize CRLFs. So, I don't have ideas to improve there in the DOM module.

Component: DOM: Editor → DOM: Core & HTML

FYI: Chrome also converts CRLFs to LFs.

data:text/html,<textarea></textarea><script>const textarea = document.querySelector("textarea"); textarea.value = "abc\r\ndef"; alert(textarea.value.replaceAll("\r\n", "CRLF"));</script>

shows:

abc
def

rather than

abcCRLFdef
Severity: -- → S3
Blocks: 1980560
See Also: 1943230
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: