Thanks. merged into git. On Sat, Jan 9, 2016 at 11:24 AM, Patrick Haller <patrick.haller@xxxxxxxxxxxxxxxxx> wrote: > Hi, > > Profiling application startup performance, I noticed that libfontconfig > accounted for a significant portion of the startup time, approx. 30% for a > rather simple application like gedit. > > My font directories, especially /usr/share/fonts/100dpi and > /usr/share/fonts/75dpi contain each 1900 files after a default gentoo > installation of X.org, residing on local storage. > > I found two rather small optimizations to improve the startup time: > - assuming that readdir() will never return duplicate filenames within the > very same directory. Hence FcStrSetAdd() can spare the duplicate check, > which currently runs FcStrCmp() along a growing linear list of filenames. In > fact, I have not found any duplicate string being entered to a FcStrSet at > all for my system configuration. > - _FcStrSetAppend() to not reallocate and memcmp element by element, but > doing so for e. g. 64 elements at a time. > > I've verified startup time using > - time gedit (average over 9 runs) > - callgrind and cachegrind > - oprofile > > > Applied optimizations: > - skip duplicate check in FcStrSetAppend for values originating from > readdir() > - grow FcStrSet in 64-element bulks for local FcStrSets (FcConfig layout > unaltered) > > Starting gedit is measured to > > Unoptimized Optimized > user[s] 0,806 0,579 > sys[s] 0,062 0,062 > Total Instr Fetch Cost: 1.658.683.750 895.069.820 > Cachegrind D Refs: 513.917.619 312.000.436 > Cachegrind Dl Misses: 8.605.632 4.954.639 > > > The patch is attached. Comments and questions are welcome. > > Thanks, > Patrick > > -- > -- > Patrick Haller (patrick.haller@xxxxxxxxxxxxxxxxx) > > > _______________________________________________ > Fontconfig mailing list > Fontconfig@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/fontconfig > -- Akira TAGOH _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig