Opened 11 years ago
Closed 11 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 11 years ago by
Status: | new → confirmed |
---|
comment:2 Changed 11 years ago by
Nothing stands out in the timeline, but I haven't dug much further yet.
comment:4 Changed 11 years ago by
Owner: | set to Piotrek Koszuliński |
---|---|
Status: | confirmed → assigned |
comment:5 Changed 11 years ago by
Owner: | Piotrek Koszuliński deleted |
---|---|
Status: | assigned → confirmed |
comment:6 Changed 11 years ago by
Milestone: | CKEditor 4.3.1 → CKEditor 4.3.2 |
---|
comment:7 Changed 11 years ago by
Owner: | set to Marek Lewandowski |
---|---|
Status: | confirmed → assigned |
Issue will be fixed by #11161.
comment:8 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in #11177 with git:32e096f4fb70

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