On Thu, Oct 16, 2003 at 06:34:54PM +0200, Jean-Marc Lasgouttes wrote: > >>>>> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: > > Andre> So 'lyx::support::ReplaceEnvironmentPath' curently wastes about > Andre> 20% of the time used by lyx startup + UserGuide loading. > > Andre> This does not seem right. > > Indeed. > > Andre> Does anybody feel a bit guilty? > > Could you show us the corresponding calling tree (later in the gprof > report)?
I better show you the fix. Setting up the patterns just one cuts this from 20% down to 2.1%. Andre'
? 1.diff Index: filetools.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v retrieving revision 1.175 diff -u -p -r1.175 filetools.C --- filetools.C 6 Oct 2003 15:43:17 -0000 1.175 +++ filetools.C 16 Oct 2003 16:35:44 -0000 @@ -742,14 +742,14 @@ string const ReplaceEnvironmentPath(stri { // ${VAR} is defined as // $\{[A-Za-z_][A-Za-z_0-9]*\} - string const envvar_br = "[$]\\{([A-Za-z_][A-Za-z_0-9]*)\\}"; + static string const envvar_br = "[$]\\{([A-Za-z_][A-Za-z_0-9]*)\\}"; // $VAR is defined as: // $\{[A-Za-z_][A-Za-z_0-9]*\} - string const envvar = "[$]([A-Za-z_][A-Za-z_0-9]*)"; + static string const envvar = "[$]([A-Za-z_][A-Za-z_0-9]*)"; - boost::regex envvar_br_re("(.*)" + envvar_br + "(.*)"); - boost::regex envvar_re("(.*)" + envvar + "(.*)"); + static boost::regex envvar_br_re("(.*)" + envvar_br + "(.*)"); + static boost::regex envvar_re("(.*)" + envvar + "(.*)"); boost::smatch what; string result = path;