Opened 10 years ago

Closed 10 years ago

#11001 closed Bug (fixed)

Drag handlers positioning coalescing

Reported by: xmo Owned by: Marek Lewandowski
Priority: Normal Milestone: CKEditor 4.3.2
Component: UI : Widgets Version:
Keywords: Cc:

Description

Working on a 4.3-based system using widgets, I recently started looking into the performances of starting the editor to see if it'd be possible to speed it up.

In my "test case" (a page of the system), CKEDITOR.inline is called on a page section holding 1300 nodes, including 46 would-be widget.

Looking at the Chrome timeline (frames section), I noticed that within CKEDITOR's "readiness" handler (a timer in scriptloader), there's a significant sequence of layout recomputations which Chrome marks with a warning (it's a whole-document synchronous operation).

The issue here is that positionDragHandler accesses offsetTop and offsetLeft which requires a valid layout, but the setup of each widget invalidates the layout by setting a bunch classes & attributes on it. Which means the layout must be entirely recomputed during each positionDragHandler, aka once per widget.

Coalescing the calls (by setting up a timeout, adding widgets to a queue then running the actual positionDragHandler on all widgets at once) saves about 100ms between the call to CKEDITOR.inline and the triggering of instanceReady (~1400ms -> ~1300ms) on a 15" 2010 MBP, under Chrome 29. It also makes the timeline significantly cleaner.

Change History (8)

comment:1 Changed 10 years ago by Piotrek Koszuliński

Status: newconfirmed

Thanks for feedback on this. Have you noticed any other operations done during widgets initialization which force reflow?

comment:2 Changed 10 years ago by xmo

Nothing stands out in the timeline, but I haven't dug much further yet.

comment:3 Changed 10 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.3.1

Related ticket: #11161.

comment:4 Changed 10 years ago by Piotrek Koszuliński

Owner: set to Piotrek Koszuliński
Status: confirmedassigned

comment:5 Changed 10 years ago by Piotrek Koszuliński

Owner: Piotrek Koszuliński deleted
Status: assignedconfirmed

comment:6 Changed 10 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.3.1CKEditor 4.3.2

comment:7 Changed 10 years ago by Marek Lewandowski

Owner: set to Marek Lewandowski
Status: confirmedassigned

Issue will be fixed by #11161.

comment:8 Changed 10 years ago by Marek Lewandowski

Resolution: fixed
Status: assignedclosed

Fixed in #11177 with git:32e096f4fb70

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy