URL: <http://savannah.gnu.org/bugs/?53060>
Summary: [xlib] Significant slowness with some apps, font-related Project: GNUstep Submitted by: yavor Submitted on: Sun 04 Feb 2018 02:06:04 AM EET Category: Backend Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any _______________________________________________________ Details: The xlib backend is nearly unusable with some apps. On my main workstation (not powerful but with many fonts installed) it takes about a minute for SimpleAgenda to appear and become responsive. Then if I click on another tab, I have to wait ~15 seconds; the UI is blocked until then. The log shows some of these: 2018-02-04 01:00:14.278 SimpleAgenda[24146:24146] attempt to initialize character set with invalid bitmap Putting a break on NSCharacterSet.m:206 reveals: Breakpoint 1, -[NSBitmapCharSet initWithBitmap:] (self=0x5555574a8340, _cmd=<optimized out>, bitmap=0x5555574140c0) at NSCharacterSet.m:206 206 NSLog(@"attempt to initialize character set with invalid bitmap"); (gdb) p length $1 = 1114112 (gdb) bt 2 #0 0x00007ffff6848a78 in -[NSBitmapCharSet initWithBitmap:] (self=0x5555574a8340, _cmd=<optimized out>, bitmap=0x5555574140c0) at NSCharacterSet.m:206 #1 0x00007ffff68463fc in +[NSCharacterSet characterSetWithBitmapRepresentation:] (self=<optimized out>, _cmd=<optimized out>, data=0x5555574140c0) at NSCharacterSet.m:800 #2 0x00007fffeb20d919 in -[GSXftFontInfo coveredCharacterSet] (self=0x555555f376f0, _cmd=<optimized out>) at GSXftFontInfo.m:368 The first patch addresses this but the slowness remains. With --GNU-Debug=NSFont, there is intensive output after the loop in -enumerateFontsAndFamilies. There are an awful lot of repetitions of the debug output in -setupAttributes, for the same fonts over and over: +verabtim+ 2018-02-04 01:28:29.778 SimpleAgenda[24287:24287] Loaded font: Samyak Tamil 2018-02-04 01:28:29.805 SimpleAgenda[24287:24287] Loaded font: Noto Sans Telugu UI 2018-02-04 01:28:29.826 SimpleAgenda[24287:24287] Loaded font: URW Gothic L 2018-02-04 01:28:29.858 SimpleAgenda[24287:24287] Loaded font: TeX Gyre Cursor 2018-02-04 01:28:29.886 SimpleAgenda[24287:24287] Loaded font: Noto Sans Malayalam-Bold 2018-02-04 01:28:29.912 SimpleAgenda[24287:24287] Loaded font: STIXGeneral 2018-02-04 01:28:29.948 SimpleAgenda[24287:24287] Loaded font: AnjaliOldLipi 2018-02-04 01:28:29.964 SimpleAgenda[24287:24287] Loaded font: Dingbats 2018-02-04 01:28:29.995 SimpleAgenda[24287:24287] Loaded font: Noto Sans Oriya-Bold 2018-02-04 01:28:30.023 SimpleAgenda[24287:24287] Loaded font: Chilanka 2018-02-04 01:28:30.049 SimpleAgenda[24287:24287] Loaded font: LucidaTypewriter 2018-02-04 01:28:30.091 SimpleAgenda[24287:24287] Loaded font: ori1Uni 2018-02-04 01:28:30.120 SimpleAgenda[24287:24287] Loaded font: URW Gothic L-Demibold 2018-02-04 01:28:30.156 SimpleAgenda[24287:24287] Loaded font: Free Courier-BoldOblique 2018-02-04 01:28:30.196 SimpleAgenda[24287:24287] Loaded font: FreeSerif-Bold 2018-02-04 01:28:30.227 SimpleAgenda[24287:24287] Loaded font: TeX Gyre Termes Math 2018-02-04 01:28:30.247 SimpleAgenda[24287:24287] Loaded font: TeX Gyre Cursor-BoldItalic 2018-02-04 01:28:30.272 SimpleAgenda[24287:24287] Loaded font: Samyak Gujarati 2018-02-04 01:28:30.297 SimpleAgenda[24287:24287] Loaded font: Noto Sans Georgian-Bold 2018-02-04 01:28:30.325 SimpleAgenda[24287:24287] Loaded font: Terminal-Bold The above is just a small snippet from the output. I have to kill the app with kill(all) from another terminal. CPU usage is intensive, and HDD too if debug output is enabled. This is reproducible with some apps like SimpleAgenda, LuserNET, PikoPixel, Preview, Cenon (to an extent), Grr (when you click on a feed) and especially Charmap. I cannot reproduce with AClock, Timemon, Gorm, PRICE, FTP, Ink or SystemPreferences. The second patch introduces glyph caching in a very similar way as it is done for the other backends. I thought initially that this was the culprit but I was completely wrong. As I've made it anyway and it is some improvement, I thought it wouldn't hurt to share it although it doesn't solve the problem. This bug is reproducible with GUI/Back 0.25.0 as well. I tried to track down the issue but there are so many hoops through GSLayoutManager/NSGlyphGenerator that I got utterly confused at the end, especially when I tried to compare the behavior with the other backends. Perhaps a proper programmer would spot and solve the bug easily. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Sun 04 Feb 2018 02:06:04 AM EET Name: 0001-xlib-Protect-against-invalid-characters-in-coveredCh.patch Size: 1KiB By: yavor <http://savannah.gnu.org/bugs/download.php?file_id=43165> ------------------------------------------------------- Date: Sun 04 Feb 2018 02:06:04 AM EET Name: 0002-xlib-Add-support-for-glyph-caching.patch Size: 3KiB By: yavor <http://savannah.gnu.org/bugs/download.php?file_id=43166> _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?53060> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-gnustep mailing list Bug-gnustep@gnu.org https://lists.gnu.org/mailman/listinfo/bug-gnustep