<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - code from git is slow compared 2.11"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=94427">94427</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>code from git is slow compared 2.11
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>fontconfig
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>fontconfig-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kokoko3k@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>freedesktop@behdad.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=122139" name="attach_122139" title="grep ^stat64 /tmp/out_fast|grep font >/tmp/stat_fast.txt">attachment 122139</a> <a href="attachment.cgi?id=122139&action=edit" title="grep ^stat64 /tmp/out_fast|grep font >/tmp/stat_fast.txt">[details]</a></span>
grep ^stat64 /tmp/out_fast|grep font >/tmp/stat_fast.txt

On a not so powerfull ATOM 330 running at 2ghz, i've noticed that even the
simplest gui application using qt4 or gtk2 toolkits (didn't test other) suffers
from a high delay when starting up.
On this particular machine, i measured it to be around one second.


The following script /tmp/startuptime.sh 
measures the application startup time of the program "gtk-demo"
#---------------------------------------------------------------------
#!/bin/bash
ln -s /usr/bin/sleep /tmp/mysleep &>/dev/null
time /tmp/mysleep 999 &

gtk-demo &
while true ; do
    wmctrl -l|grep 'GTK+ Code Demos' &>/tmp/out
    if [ $? -eq 0 ] ; then
        killall mysleep &>/tmp/out
        break
    fi
    sleep 0.05
done
killall gtk-demo &>/tmp/out
unlink /tmp/mysleep
#---------------------------------------------------------------------



Test startup time with fontconfig and freetype from git:
#---------------------------------------------------------------------
$ /tmp/startuptime.sh
/tmp/startuptime.sh: riga 3:  4321 Terminato               /tmp/mysleep 999

real    0m1.149s
user    0m0.000s
sys     0m0.000s
#---------------------------------------------------------------------



Now with standard fontconfig and freetype:
#---------------------------------------------------------------------
$ /tmp/startuptime.sh
/tmp/startuptime.sh: riga 3:  4508 Terminato               /tmp/mysleep 999

real    0m0.325s
user    0m0.000s
sys     0m0.000s
#---------------------------------------------------------------------



If i isolate just use fontconfig from git, and freetype stable:
#---------------------------------------------------------------------
$ pacman -Q|grep 'fontconfig\|freetype2'
fontconfig 2.11.1-2
freetype2-infinality-ultimate 2.6.2-4

$ /tmp/startuptime.sh
/tmp/startuptime.sh: riga 3:  5692 Terminato               /tmp/mysleep 999

real    0m0.386s
user    0m0.000s
sys     0m0.000s
#---------------------------------------------------------------------




So it seems fontconfig is doing a lot of work with the ultimate patches.
This happens with regular user account, never-used user accounts and the root
account too.
I've already tried to rebuild the font cache with fc-cache -f and ran it with
root and regular user, without success...

i used strace to debug the issue (strace -f gtk-demo)
and created two files: out_slow and out_fast:

$ grep ^stat64 /tmp/out_slow|grep font|wc -l
4600

$ grep ^stat64 /tmp/out_fast|grep font|wc -l
47

In out_slow, you see, it seems to walk across all of the fonts and more:

grep ^stat64 /tmp/out_fast|grep font >/tmp/stat_fast.txt
<a href="http://pastebin.com/vBLXakzT">http://pastebin.com/vBLXakzT</a>

grep ^stat64 /tmp/out_slow|grep font >/tmp/stat_slow.txt
<a href="http://pastebin.com/f8KGrFGr">http://pastebin.com/f8KGrFGr</a>

complete strace fast
<a href="http://pastebin.com/60RsQpy2">http://pastebin.com/60RsQpy2</a>

complete strace slow (had to split these because they were too big)
<a href="http://pastebin.com/fbXDFN2B">http://pastebin.com/fbXDFN2B</a>
<a href="http://pastebin.com/We6SxwN0">http://pastebin.com/We6SxwN0</a>

I cant undesrtand if this is a bug or just the expected behaviour.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>