Skip to content

Slow incremental layout after deleting a page #12964

@vmiklos

Description

@vmiklos

Describe the Bug

This is similar to #11785, here deleting a page from the document triggers an effectively synchronous layout, so Writer does not accept new keystrokes for about 1 second.

Steps to Reproduce

  1. Open public.odt
  2. Go to page 2, which only has an empty paragraph
  3. Press backspace twice, without waiting between the two events.

Expected Behavior

We get tiles fast

Actual Behavior

Wave a delay on the 2nd backspace. In terms of numbers, here is normal vs slow JS console output:

normal: 165 ms
13:40:49.405 global.js:594 1757504449405 OUTGOING: removetextcontext id=0 before=1 after=0
13:40:49.421 global.js:594 1757504449421 INCOMING: invalidatetiles: part=0 mode=0 x=2138 y=15669 width=8917 height=275 wid=107 
13:40:49.422 global.js:594 1757504449422 INCOMING: invalidatecursor: { "viewId": "4", "rectangle": "3331, 15669, 0, 276", "mispelledWord": "0", "hyperlink": {} }
13:40:49.570 global.js:594 1757504449570 INCOMING: delta: nviewid=1000 part=0 width=256 height=256 tileposx=0 tileposy=15360 tilewidth=3840 tileheight=3840 oldwid=1 wid=108 ver=23 imgsize=1

slow: 702 ms
13:41:59.993 global.js:594 1757504519993 OUTGOING: removetextcontext id=0 before=1 after=0
13:42:00.679 global.js:594 1757504520679 INCOMING: invalidatetiles: EMPTY, 0, 0 wid=134
13:42:00.683 global.js:594 1757504520683 INCOMING: invalidatecursor: { "viewId": "4", "rectangle": "7711, 15669, 0, 276", "mispelledWord": "0", "hyperlink": {} }
13:42:00.695 global.js:594 1757504520695 INCOMING: delta: nviewid=1000 part=0 width=256 height=256 tileposx=3840 tileposy=11520 tilewidth=3840 tileheight=3840 oldwid=1 wid=136 ver=31 imgsize=1

Screenshots

The performance profile is this:

Image

It shows that we spend time in the idle layout, which is fine, but we should process the 2nd backspace first, and only then do a full layout in the background.

Additional Context

It seems this was fine in 24.04, but was always bad in 25.04.

Metadata

Metadata

Assignees

Labels

25.04bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions