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.77k stars 679 forks source link

Generic 24.04 Calc performance ticket #8570

Open caolanm opened 5 months ago

caolanm commented 5 months ago

Lets track 24.04 separately than earlier releases wrt flamegraph results

caolanm commented 5 months ago

perf-31964

Todays calc 24.04 flamegraph

caolanm commented 5 months ago

Todays's calc 24.04 flamegraphs

perf-2784

perf-4121

caolanm commented 5 months ago

perf-25018

part of todays 24.04 calc test

grandinj commented 5 months ago

Well hello collectAutoStyles(), my old friend - I remember having a bash at this one, with not much success.

However, I can do something about ScDocument::GetColDefault, over here: https://gerrit.libreoffice.org/c/core/+/165346

caolanm commented 5 months ago

perf-6669

todays 24.04 calc session

caolanm commented 5 months ago

perf-16185

todays scheduled 24.04 calc profile

mmeeks commented 5 months ago

Surprisingly unbalanced re: this UpdateCursorOverlay thing ... GetRectsAnyFor should not take that sort of time clearly - for what is ultimately only a few rectangles; looks like a substantial 2x+ perf. regression in the making.

grandinj commented 5 months ago

If the spreadsheet involved had a lot of overlapping/hidden/merged cells, that would explain the time spent in GetRectsAnyFor. Unfortunately, the code involved in overlapping/hidden/merged does not look easily improved.

caolanm commented 5 months ago

perf-28863

Todays ad hoc spreadsheet test

caolanm commented 4 months ago

Todays scheduled call with 24.04

perf-7758

caolanm commented 4 months ago

perf-13632

^^^calc 24.04 session with background save enabled^^^

perf-15060

^^^calc 24.04 session with background save disabled^^^

caolanm commented 4 months ago

perf-31576

^^^calc 24.04 session with background save enabled^^^

caolanm commented 4 months ago

perf-4357

calc 24.04 session

caolanm commented 4 months ago

perf-24580

todays calc 24.04 session, background saved are merged under a single kitbgsav

caolanm commented 4 months ago

perf-27282

Tuesday calc 24.04 profiling session, with mostly automated users

caolanm commented 4 months ago

I did a retest of https://github.com/CollaboraOnline/online/issues/8570#issuecomment-2031853407 with just the watchdog profiler active and did some full column copy and pastes from out typical calc testing document

The amount of break iterator loading looks odd, GetScriptTypeOfLanguage etc.

I wonder if we really need to figure out the area affected in UpdateAutoFillOverlay to send to online via LOK_CALLBACK_CELL_AUTO_FILL_AREA of it we could send an address there instead f.e

mmeeks commented 4 months ago

Surely we can have a one item cache, or somesuch for: SvtScriptType GetScriptTypeOfLanguage( LanguageType nLang ) =)

grandinj commented 4 months ago

That flame graph looks suspiciously like a debug build.....

caolanm commented 4 months ago

objdump -Wi /opt/collaboraoffice/program/libuno_sal.so.3|grep DW_AT_producer gives....

GNU C++20 12.2.1 20221121 (Red Hat 12.2.1-4) -mtune=generic -march=x86-64 -ggdb2 -O2 -std=c++20 -fvisibility=hidden -finput-charset=UTF-8 -fmessage-length=0 -fno-common -fstack-clash-protection -fcf-protection=full -fstack-protector-strong -fvisibility-inlines-hidden -fPIC -fexceptions -fno-enforce-eh-specs

and similar for coolwsd itself

grandinj commented 4 months ago

Then I am guessing that o3tl::strong_int:anyOf is not being compiled properly on that platform, for some reason, because it should definitely turn into just a handful of immediate instructions.

In which case we should change we should change MsLangId::getScriptType to use explicit if/then statements instead of o3tl::strong_int::anyOf

caolanm commented 4 months ago

perf-32127

Todays calc weekly session, online commit: https://github.com/CollaboraOnline/online/commits/cd9875ec core commit: https://git.libreoffice.org/core/+log/07c93a6

coolwsd.xml contains:

true

I wonder why I don't see kitbgsav in this session

caolanm commented 3 months ago

perf-60263

background save as expected

https://git.libreoffice.org/core/+log/421ef05 https://github.com/CollaboraOnline/online/commits/1b586a5

mmeeks commented 3 months ago

Hmm - that trace has 40% of the save time in the foreground - which is unexpected; we should have one non-background save at exit but ... =) Still no sign of: "WRN Failed to ensure we have just one, we have: 2| kit/Kit.cpp:1388" in the logs since the 17th which is good; prolly nailed that then.

caolanm commented 3 months ago

perf-21330

todays scheduled calc testing profile

mmeeks commented 3 months ago

Feedback was very positive on copy/paste today thanks @grandinj =) Digging into the 'GetOptimalHeight' code-path there I see that (oddly) there seems to be an explicit call to OutputDevice::GetTextWidth as a child of GetOptimalHeight which looks like something we could loose easily ? =) And I wonder if there are other height-not-width optimizations we could do there somehow. Anyhow - glad its feeling better :-)

grandinj commented 3 months ago

there seems to be an explicit call to OutputDevice::GetTextWidth as a child of GetOptimalHeight which looks like something we could loose easily ?

Fix (I think) here: https://gerrit.libreoffice.org/c/core/+/167988

caolanm commented 3 months ago

perf-13757

Todays devel version

caolanm commented 3 months ago

perf-258206

Todays stable version

caolanm commented 3 months ago

perf-349039

profile taken during calc testing while I wasn't present, so I'm not sure about this one, but I'll put it here anyway

caolanm commented 3 months ago

perf-18582

Tue test of devel version

caolanm commented 3 months ago

perf-720446

Tue test of stable 24.04 version

mmeeks commented 3 months ago

There is concerningly little threading of delta compression in the last two profiles; it seems we do almost all the work in-line in the main thread there; that points to something bad; I wonder if we (I) have screwed up the rendering coalescing of tiles so we render one tile at a time somehow; if so that would be not good(TM).

caolanm commented 3 months ago

perf-25328

Todays staging-perf calc profile

caolanm commented 2 months ago

perf-70635-calc-share

24.04.4.3snapshot git hash: 8628721 Collabora Office 24.04.4.20240629 git hash: 2657979

caolanm commented 2 months ago

perf-4348-calc

24.04.4.2 git hash: https://github.com/CollaboraOnline/online/commit/20b6b94a32ca8cb6bc4e7a7950755673e3ab87b0 Collabora Office 24.04.4.2 git hash: 2d2c24d (confusingly this one is master I think and the above is 24.04 branch)

caolanm commented 2 months ago

perf-4423

todays regular scheduled cool meeting calc test

caolanm commented 2 months ago

perf-69026

todays co-24.04 calc collaborative testing session

caolanm commented 2 months ago

perf-32718

weekly collaborative calc testing session

caolanm commented 2 months ago

perf-26334

todays 24.04.5.2 collaborative calc testing session

caolanm commented 2 months ago

perf-266094

todays 24.04.4.5 collaborative calc testing session

caolanm commented 1 month ago

perf-13463

Todays regular scheduled cool meeting calc profile

caolanm commented 1 month ago

perf-10677

calc collaborative testing

caolanm commented 1 month ago

perf-20312

Todays calc profile. I see a non-async SvxCharacterMap::run call in there FWIW

caolanm commented 1 month ago

perf-2306

Todays, share calc profile

caolanm commented 1 month ago

perf-13597

Todays staging calc profile, transliteration wrapper seems hot

mmeeks commented 1 month ago

@grandinj ooh - that's interesting - 8% of our time saving (and prolly lots of memory wasteage) is from ScXMLExport::WriteTable to ScMyDefaultStyles::FillDefaultStyles to ScDocument::CreateColumnIfNotExists - which seems like a bug; are we creating all columns on save/export again somehow ? =)

caolanm commented 1 month ago

perf-17372

Today's calc collaborative session

caolanm commented 2 weeks ago

perf-826568

Today's calc session on stable version

caolanm commented 2 weeks ago

perf-21782

Today's calc session in master version with a large copy and paste. If we have background saves, maybe we should have some form of background copy to clip.

caolanm commented 2 weeks ago

perf-16789

Today's brief staging-perf calc session