Re: Start speedup

From: Sir Basic <phoenix_at_freemail.hu>
Date: Mon Oct 25 2004 - 10:26:55 CEST

Here you are!

  Attila

====
--- xap_UnixFontManager~.cpp 2004-10-22
13:28:50.000000000 +0200
+++ xap_UnixFontManager.cpp 2004-10-22
13:28:59.000000000 +0200
@@ -111,12 +111,15 @@
        // TODO: We should follow symlinks.
        metricFile = reinterpret_cast<char*>(fontFile);
        size_t ffs = metricFile.size();
- if (ffs < 4 || (fontFile[ffs - 4] != '.' &&
fontFile[ffs - 5] != '.'))
+ if ( ! ( (ffs >= 4 && fontFile[ffs - 4] == '.') ||
(ffs >= 5 && fontFile[ffs - 5] == '.') ) )
                return NULL;

        // handle '.font'
        if (fontFile[ffs - 5] == '.')
+ {
                metricFile =
UT_UTF8String(metricFile.ucs4_str().substr(0,
metricFile.size() - 1));
+ --ffs;
+ }

        metricFile.ucs4_str()[ffs - 3] = 'a';
        metricFile.ucs4_str()[ffs - 2] = 'f';
====

Dom Lachowicz <domlachowicz@yahoo.com> rta:

>
> Hi Attila!
>
> It looks like your patch was corrupted. Would you mind
> resending it?
>
> Thanks again!
> Dom
>
> --- Sir Basic <phoenix@freemail.hu> wrote:
>
> > Hi!
> >
> > I've discovered some points in "buildFont" function
> > that can
> > be bugs. The [-1] element of "fontFile" could be
> > accessed in
> > some cases. If the extension is ".font" then the
> > postfix
> > change seems improper. Please check the attached
> > file for
> > modifications.
> >
> > Meanwhile I've profiled the startup several times.
> > It seems
> > the overall running time of "buildFont" is not as
> > long as
> > I've thought before (something like 6%, proportional
> > to the
> > number of fonts installed). But please note that the
> > function spends one half of its time with those
> > string
> > operations. The nice-looking rows
> > metricFile.ucs4_str()[ffs - 3] = 'a';
> > metricFile.ucs4_str()[ffs - 2] = 'f';
> > metricFile.ucs4_str()[ffs - 1] = 'm';
> > cost 37% of execution time of the whole function
> > because of
> > the repeated call on "ucs4_str()".
> >
> > Attila> --- xap_UnixFontManager~.cpp 2004-10-22
> > 13:28:50.000000000 +0200
> > +++ xap_UnixFontManager.cpp 2004-10-22
> > 13:28:59.000000000 +0200
> > @@ -111,12 +111,15 @@
> > // TODO: We should follow symlinks.
> > metricFile = reinterpret_cast<char*>(fontFile);
> > size_t ffs = metricFile.size();
> > - if (ffs < 4 || (fontFile[ffs - 4] != '.' &&
> > fontFile[ffs - 5] != '.'))
> > + if ( ! ( (ffs >= 4 && fontFile[ffs - 4] == '.') ||
> > (ffs >= 5 && fontFile[ffs - 5] == '.') ) )
> > return NULL;
> >
> > // handle '.font'
> > if (fontFile[ffs - 5] == '.')
> > + {
> > metricFile =
> > UT_UTF8String(metricFile.ucs4_str().substr(0,
> > metricFile.size() - 1));
> > + --ffs;
> > + }
> >
> > metricFile.ucs4_str()[ffs - 3] = 'a';
> > metricFile.ucs4_str()[ffs - 2] = 'f';
> >
> W&#65533;X&#65533; .&#65533;2QB&#65533;g7tt5`I&#65533;*nQ _DX cT0
> > &#65533;t&#65533;t&#65533;&#65533;&#65533;z&#65533;}*dɼ9
> > z&#65533;iv@v&#65533;&#65533;+P
>
J4~*4NlsEQ4ֻޭ_a&#65533;Bq5THL{&#65533;&#65533;aL$Ew%+&#65533;&#65533;yi&}p=ʬ&#65533;{ U:0:lV6&#65533;N&#65533;^
>
>
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>

Received on Mon Oct 25 10:29:43 2004

This archive was generated by hypermail 2.1.8 : Mon Oct 25 2004 - 10:29:43 CEST