Bug 158287 - Slow startup in presence of iosevka font (FreeBSD & Gentoo)
Summary: Slow startup in presence of iosevka font (FreeBSD & Gentoo)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.6.2.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: perf
Depends on:
Blocks: Fonts
  Show dependency treegraph
 
Reported: 2023-11-20 17:47 UTC by Dmitry Marakasov
Modified: 2023-11-30 12:51 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
full ktrace (4.28 MB, application/x-xz)
2023-11-30 12:51 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov 2023-11-20 17:47:50 UTC
I'm experiencing slow startup times on core i7-6600U laptop for both lowriter and localc. System is FreeBSD 13.2 and libreoffice is 7.6.2.1. After doing some tracing with FreeBSD ktrace tool, it turned out that what slows it down is openning font (iosevka in this case) files thousands of times. Here's an excerpt form kdump output:

```
 56210 soffice.bin CALL  openat(AT_FDCWD,0x898551f08,0<O_RDONLY>)
 56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka.ttc"
 56210 soffice.bin RET   openat 24/0x18
 56210 soffice.bin CALL  fstat(0x18,0x821158f60)
 56210 soffice.bin STRU  struct stat {dev=6602381364165455651, ino=853229, mode=0100644, nlink=1, uid=0, gid=0, rdev=18446744073709551615, atime=1700500430.680679000, mtime=1700500431.123096000, ctime=1700500463.811403000, birthtime=1700500431.123096000, size=261945172, blksize=131072, blocks=205593, flags=0x800 }
 56210 soffice.bin RET   fstat 0
 56210 soffice.bin CALL  mmap(0,0xf9cf754,0x1<PROT_READ>,0x1<MAP_SHARED>,0x18,0)
 56210 soffice.bin RET   mmap 38558236672/0x8fa400000
 56210 soffice.bin CALL  close(0x18)
 56210 soffice.bin RET   close 0
 56210 soffice.bin CALL  munmap(0x8fa400000,0xf9cf754)
 56210 soffice.bin RET   munmap 0
```

it can be seen that it opens and then closes iosevka font file, but this repeats several thousand times for each font file:

```
% kdump | grep NAMI | grep iosevka | sort | uniq -c                                                                                                                       1
 783  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-aile.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-curly-slab.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-curly.ttc"
 783  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-etoile.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-slab.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss01.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss02.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss03.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss04.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss05.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss06.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss07.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss08.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss09.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss10.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss11.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss12.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss13.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss14.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss15.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss16.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss17.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka-ss18.ttc"
26568  56210 soffice.bin NAMI  "/usr/local/share/fonts/Iosevka/iosevka.ttc"
```

There's definitely something going wrong here. Removing iosevka font expectendly fixes slow startup.

- Full kdump output: https://people.freebsd.org/~amdmi3/libreoffice.ktrace.txt.xz
- FreeBSD bug report https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275218
- Similar Gentoo report I've run into: https://forums.gentoo.org/viewtopic-p-8807292.html
Comment 1 Buovjaga 2023-11-30 12:50:51 UTC
NEW per https://forums.gentoo.org/viewtopic-p-8807292.html

I don't reproduce the slow startup myself after installing https://archlinux.org/packages/extra/any/ttc-iosevka/

Arch Linux 64-bit, X11
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 60(Build:1)
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
7.6.2-3
Calc: threaded
Comment 2 Buovjaga 2023-11-30 12:51:23 UTC
Created attachment 191142 [details]
full ktrace