ooo-build r14169 - trunk/patches/dev300
- From: michael svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14169 - trunk/patches/dev300
- Date: Wed, 1 Oct 2008 13:53:19 +0000 (UTC)
Author: michael
Date: Wed Oct 1 13:53:19 2008
New Revision: 14169
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14169&view=rev
Log:
transex speedup - un-tested ...
Added:
trunk/patches/dev300/speed-build-transex.diff
Added: trunk/patches/dev300/speed-build-transex.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/speed-build-transex.diff Wed Oct 1 13:53:19 2008
@@ -0,0 +1,154 @@
+diff -u -w -r transex3/source/merge.cxx transex3/source/merge.cxx
+--- transex3/source/merge.cxx 2008-04-10 10:42:45.000000000 +0100
++++ transex3/source/merge.cxx 2008-10-01 14:49:17.000000000 +0100
+@@ -210,6 +210,7 @@
+ ByteString sTEXT;
+ ByteString sQHTEXT;
+ ByteString sTITLE;
++ ByteString sHACK("HACK");
+
+ const ByteString sEmpty("");
+
+@@ -218,30 +219,29 @@
+ exit( -1 );
+ }
+ while ( !aInputStream.IsEof()) {
++ xub_StrLen nToks;
+ aInputStream.ReadLine( sLine );
+ sLine = sLine.Convert( RTL_TEXTENCODING_MS_1252, aCharSet );
+
+- if ( sLine.GetTokenCount( '\t' ) == 15 ) {
++ nToks = sLine.GetTokenCount( '\t' );
++ if ( nToks == 15 ) {
+ // Skip all wrong filenames
+ ByteString filename = sLine.GetToken( 1 , '\t' );
+ filename = filename.Copy( filename.SearchCharBackward( "\\" )+1 , filename.Len() );
+
+ if( sFile.Equals( sEmpty ) || ( !sFile.Equals( sEmpty ) && filename.Equals( sFile ) ) )
+ {
+- sTYP = sLine.GetToken( 3, '\t' );
+- sGID = sLine.GetToken( 4, '\t' );
+- sLID = sLine.GetToken( 5, '\t' );
+- sPFO = sLine.GetToken( 7, '\t' );
+- sPFO = ByteString("HACK");
+- nLANG = sLine.GetToken( 9, '\t' );
+-
+- sTEXT = sLine.GetToken( 10, '\t' );
+- // printf("%s\n",sTEXT.GetBuffer());
+- // Quote( sTEXT );
+- // printf("%s\n",sTEXT.GetBuffer());
+-
+- sQHTEXT = sLine.GetToken( 12, '\t' );
+- sTITLE = sLine.GetToken( 13, '\t' );
++ xub_StrLen rIdx = 0;
++ sTYP = sLine.GetToken( 3, '\t', rIdx );
++ sGID = sLine.GetToken( 1, '\t', rIdx ); // 4
++ sLID = sLine.GetToken( 1, '\t', rIdx ); // 5
++ sPFO = sLine.GetToken( 2, '\t', rIdx ); // 7
++ sPFO = sHACK;
++ nLANG = sLine.GetToken( 2, '\t', rIdx ); // 9
++
++ sTEXT = sLine.GetToken( 1, '\t', rIdx ); // 10
++ sQHTEXT = sLine.GetToken( 2, '\t', rIdx ); // 12
++ sTITLE = sLine.GetToken( 1, '\t', rIdx ); // 13
+
+ nLANG.EraseLeadingAndTrailingChars();
+
+@@ -250,20 +250,22 @@
+ #else
+ if ( !nLANG.EqualsIgnoreCaseAscii("en-US") ){
+ #endif
+- InsertEntry( sTYP, sGID, sLID, sPFO, nLANG, sTEXT, sQHTEXT, sTITLE , filename , bCaseSensitive );
+- if( nLANG.Len() > 0 ){
+- bool bFound = false;
+- for( unsigned int x = 0; x < aLanguages.size(); x++ ){
+- if( aLanguages[ x ].Equals( nLANG ) )
+- bFound = true;
+- }
++ ByteStringHashMap::const_iterator lit;
++ lit = aLanguageMap.find (nLANG);
++ ByteString aLANG;
++ if (lit == aLanguageMap.end()) {
++ aLANG = nLANG;
++ aLanguageMap.insert( ByteStringHashMap::value_type( aLANG, aLANG ) );
+ // Remember read languages for -l all switch
+- if( !bFound ) aLanguages.push_back( nLANG );
+- }
++ aLanguageList.push_back( nLANG );
++ } else
++ aLANG = lit->first;
++
++ InsertEntry( sTYP, sGID, sLID, sPFO, aLANG, sTEXT, sQHTEXT, sTITLE , filename , bCaseSensitive );
+ }
+ }
+ }
+- else if ( sLine.GetTokenCount( '\t' ) == 10 ){
++ else if ( nToks == 10 ) {
+ printf("ERROR: File format is obsolete and no longer supported!\n");
+ }
+ }
+@@ -318,7 +320,7 @@
+ fprintf( stderr, "%s\n", rLine.GetBuffer());
+ }
+ std::vector<ByteString> MergeDataFile::GetLanguages(){
+- return aLanguages;
++ return aLanguageList;
+ }
+
+ /*****************************************************************************/
+@@ -379,23 +381,32 @@
+ const ByteString &rLID, const ByteString &rPFO,
+ const ByteString &nLANG, const ByteString &rTEXT,
+ const ByteString &rQHTEXT, const ByteString &rTITLE ,
+- const ByteString &rFilename , bool bCaseSensitive
++ const ByteString &rInFilename , bool bCaseSensitive
+ )
+ /*****************************************************************************/
+ {
+ MergeData *pData;
+ BOOL bFound = FALSE;
+
+- // search for MergeData
++ // uniquify the filename to save memory.
++ ByteStringHashMap::const_iterator fit = aFilenames.find (rInFilename);
++ ByteString aFilename;
++ if (fit == aFilenames.end()) {
++ aFilename = rInFilename;
++ aFilenames.insert (ByteStringHashMap::value_type (aFilename, aFilename));
++ } else
++ aFilename = fit->first;
+
+- ByteString sKey = CreateKey( rTYP , rGID , rLID , rFilename , bCaseSensitive );
+- ByteString sKey2;
++ // search for MergeData
+
+- if( aMap.find( sKey ) != aMap.end() ){
+- pData = aMap[ sKey ];
++ ByteString sKey = CreateKey( rTYP , rGID , rLID , aFilename , bCaseSensitive );
++ MergeDataHashMap::const_iterator mit;
++ mit = aMap.find( sKey );
++ if( mit != aMap.end() ){
++ pData = mit->second;
+ }else{
+- pData = new MergeData( rTYP, rGID, rLID , rFilename );
+- aMap.insert( MergeDataHashMap::value_type( CreateKey( rTYP , rGID , rLID , rFilename , bCaseSensitive ) , pData ) );
++ pData = new MergeData( rTYP, rGID, rLID, aFilename );
++ aMap.insert( MergeDataHashMap::value_type( sKey, pData ) );
+ }
+
+ bFound = FALSE;
+
+diff -u -w -r transex3/inc/export.hxx transex3/inc/export.hxx
+--- transex3/inc/export.hxx 2008-04-10 10:26:41.000000000 +0100
++++ transex3/inc/export.hxx 2008-10-01 14:33:31.000000000 +0100
+@@ -510,7 +510,9 @@
+ SvFileStream aErrLog;
+ ByteStringSet aLanguageSet;
+ MergeDataHashMap aMap;
+- std::vector<ByteString> aLanguages;
++ ByteStringHashMap aLanguageMap;
++ std::vector<ByteString> aLanguageList;
++ ByteStringHashMap aFilenames;
+
+
+ public:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]