Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xQuartz Extremely Slow Response

I am not sure if this happens to every IDL users, but after upgrading to macOS Sierra and xQuartz 2.7.11, the response rate of my IDL widgets becomes unacceptably slow. I have the same program running on a Red Hat Enterprise Linux Workstation 6.6. It works smoothly. I used to have the same program SSH'd to OS X Mavericks before upgrading. With proper internet connection, it also worked fine. Unfortunately, I can't remember which version of the xQuartz I used.

I don't think the problem is related to SSH. I tried to both run the program with SSH and locally, the response rates seem very similar.

I tried to downgrading my xQuartz to 2.7.9, the problem was not resolved.

I tried to debug on myself, so I found the following link shares similar issue with me. https://bugs.freedesktop.org/show_bug.cgi?id=93430

The only way that can speed up the response now is to force set the output to 256 colors. But it breaks all of the color setups in my program.

All suggestions and questions are appreciated!

like image 740
yuguang Avatar asked Mar 17 '17 20:03

yuguang


1 Answers

If your IDL Widgets use Motif and XFT (antialiased fonts), then I have a solution, which can help speeding it up.

The underlying problem is in XQuartz and how it interacts with Mac graphical subsystem. All the Xlib calls which require round trip have become very slow after El Capitan. These would normally also slow down the response of X clients if you use SSH network access, but in this case, it also happens for programs, which run locally.

Since we can't fix the MacOS, we need "fix" our software and avoid the slow functions, which work just fine on other systems. And worked fine on older versions of MacOS.

First, in your own software, try to minimize the use of Xlib calls, which cause round trips: XSync, XInternAtom, XGetWindowAttributes, XQuery* (XQueryColor, XQueryBestCursor, XQueryBestSize, ...), XGetAtom...

This will help the performance in any Xt based toolkit. On normal X Servers, if running locally, it will not be a huge gain, but on XQuartz, it will make a big difference.

Finally, if you use Motif with XFT, you can download the latest Motif version from Sourceforge https://sourceforge.net/projects/motif/ and apply the fix described in this bug report: http://bugs.motifzone.com/show_bug.cgi?id=1715 which solves the issue of querying background color for every label drawn with XFT fonts.

You can observe the speedup I have obtained for my software in this video (Motif XFT text label fix) https://www.youtube.com/watch?v=Tg8KQrU0XkU and in this video (reducing XSnyc calls by using tiling to reuse shared memory buffer) https://www.youtube.com/watch?v=MNxnOeqiOCw

like image 105
user1336365 Avatar answered Sep 20 '22 21:09

user1336365