CollaboraOnline / online

Collabora Online is a collaborative online office suite based on LibreOffice technology. This is also the source for the Collabora Office apps for iOS and Android.
https://collaboraonline.com
Other
1.85k stars 701 forks source link

perf: calc avoid full invalidation on new user join #7951

Closed mmeeks closed 9 months ago

mmeeks commented 10 months ago

Turn on 'invalidation' debugging in the help->triple click overlay. Join the document from another view. Notice the huge whole-document invalidation.

That shouldn't be there =)

Also - we should have a unit test for this that tests all components to ensure this doesn't happen / regression =)

caolanm commented 10 months ago

First part merged as https://gerrit.libreoffice.org/c/core/+/161757

Second part as https://gerrit.libreoffice.org/c/core/+/161791 In writer the ViewOptions are in the ViewShell and are copied when a new ViewShell is created from another so the dark/light-mode and doc color are the same, in calc the ViewOptions exist in both the ViewShell and Document and a new ViewShell copies from the document not the old ViewShell. Setting the ViewOptions of a ViewShell in calc doesn't affect new ViewShells created from the first and the mismatch in ViewOptions triggers an invalidation. Disentangled the existing calc ViewOptions from the relatively new LoKIT options and move them into the ViewShell and out of the problematic ViewOptions.

There still remains a third invalidation on join however, lcl_ExtendTiledDimension invalidates two rects in a row and they are combined into a single rect which invalidates the whole typical initial viewbox. Which also suggests if user 1 is at some position in the doc outside the initial set of row/cols and then user 2 joins and scrolls to that position, outside their initial range, that user 1 would get an invalidation as user 2 enters that region. Some more debugging to do.

mmeeks commented 10 months ago

Thanks Caolan ! =) Looks good - I suspect we're over-doing coalescing calc invalidations into huge rectangles IIRC we saw this with someone editing in A1, and someone else in S50 rather often we get large rectangular invalidations - but this is probably some other overly-optimistic merging location I guess.

caolanm commented 9 months ago

https://gerrit.libreoffice.org/c/core/+/161791 and https://gerrit.libreoffice.org/c/core/+/162412