It happens for me each time I restart the app. The first time it takes ~20 seconds, the next time it's much faster. This is using openjdk 21.0.1 on macOS Sonoma 14.1.2 (not using Docker).
Checked ~/.pdfbox.cache and it gets written every run. Did some debugging and it looks like I'm hitting this case: // re-build the entire cache if we encounter un-cached fonts (could be optimised) LOG.warn(pending.size() + " new fonts found, font cache will be re-built"); pending contains these values: /System/Library/Fonts/NotoSansKannada.ttc /System/Library/Fonts/NotoSerifMyanmar.ttc Seems like these fonts fail to load and are not added to the disk cache file. See stack trace below. BR Kjetil java.io.EOFException at org.apache.fontbox.ttf.TTFDataStream.readUnsignedShort(TTFDataStream.java:154) at org.apache.fontbox.ttf.TTFDataStream.readUnsignedShortArray(TTFDataStream.java:188) at org.apache.fontbox.ttf.GlyphSubstitutionTable.readMultipleSubstitutionSubtable(GlyphSubstitutionTable.java:412) at org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupSubtable(GlyphSubstitutionTable.java:263) BR Kjetil man. 4. des. 2023 kl. 16:41 skrev Tilman Hausherr <thaush...@t-online.de>: > This should happen only once in 3.0.1, unless you're working with a > container without font cache file in the image. > > SHA512 checksum is done only if the file modification date of a font file > has changed, then we check whether the content has changed. > > Tilman > > -- Original-Nachricht -- > Von: Kjetil Ødegaard <kje...@dcompany.no.invalid> > Betreff: Font operation takes a long time with 3.0.1 > Datum: 04.12.2023, 16:21 Uhr > An: users@pdfbox.apache.org > > Hi, > > I tried to upgrade an app to PDFBox 3.0.1 and I see a performance issue. > > It only affects the first PDF operation (after that it's quite fast), but > it's a bit annoying since it takes about 20 seconds (on my M1 Macboox). > > Profiling reveals that this Kotlin code triggers the delay: > > val font = PDType1Font(Standard14Fonts.FontName.COURIER) > > The thread dump shows that almost all time is spent in this method: > > org.apache.pdfbox.pdmodel.font.FileSystemFontProvider#computeHash > > I assume that this is related to PDFBOX-5684. > > Is this possible to work around? Or is it possible to fix? > > BR Kjetil > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org > For additional commands, e-mail: users-h...@pdfbox.apache.org > >