Re: Start speedup

From: Dom Lachowicz <domlachowicz_at_yahoo.com>
Date: Fri Oct 22 2004 - 18:18:36 CEST

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';
>
WX .2QBg7tt5`IԆ*nQ _DX cT0
> ttz}*dɼ9
> ziv@vؖ+P
J4~*4NlsEQ4ֻޭ_aBq5THL{aL$Ew%+͙yi&}p=ʬ{ U:0:lV6N^

                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
Received on Fri Oct 22 18:17:18 2004

This archive was generated by hypermail 2.1.8 : Fri Oct 22 2004 - 18:17:18 CEST