[Lxr-commits] CVS: lxr/scripts Tagger.pm,1.2,1.3
Brought to you by:
ajlittoz
From: Andre-Littoz <ajl...@us...> - 2013-11-17 15:57:46
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10262/scripts Modified Files: Tagger.pm Log Message: genxref, scripts/Tagger.pm: optimise indexing step for speed (notably decreasing number of COMMITs); keep both components in sync Index: Tagger.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/Tagger.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Tagger.pm 24 Sep 2013 15:35:38 -0000 1.2 +++ Tagger.pm 17 Nov 2013 15:57:42 -0000 1.3 @@ -41,18 +41,27 @@ if ($index) { my $fileid = $index->fileid($pathname, $revision); - $index->setfilerelease($fileid, $releaseid); if (!$index->fileindexed($fileid)) { # $index->emptycache(); - print(STDERR " ${VTgreen}$fileid${VTnorm}\n"); + print(STDERR " ${VTgreen}$fileid${VTnorm}"); my $path = $files->realfilename($pathname, $releaseid); - $lang->indexfile($pathname, $path, $fileid, $index, $config); - $index->setfileindexed($fileid); - $index->flushcache(); - $index->commit; + if (defined($path)) { + my $ns = $lang->indexfile($pathname, $path, $fileid, $index, $config); + print(STDERR ' :: ', $ns, "\n"); + $index->flushcache(0); + $index->setfileindexed($fileid); +### The following line is commented out to improve performance. +### The consequence is a higher load on memory since DB updates +### are kept in memory until commit time (at least on directory +### exit). +# $index->commit(); +### This line is ABSOLUTELY mandatory in case multi-thread is publicly released + } else { + print(STDERR " ${VTred}FAILED${VTnorm}\n"); + } $files->releaserealfilename($path); } else { print(STDERR " ${VTyellow}already indexed${VTnorm}\n"); @@ -81,25 +90,34 @@ my $fileid = $index->fileid($pathname, $revision); if (!$index->filereferenced($fileid)) { -# $index->emptycache(); print(STDERR " ${VTgreen}$fileid${VTnorm} "); my $path = $files->realfilename($pathname, $releaseid); - - print ( STDERR - '+++ ' - , $lang->referencefile - ( $pathname - , $path - , $fileid - , $index - , $config - ) - , "\n" - ); - $index->setfilereferenced($fileid); - $index->flushcache(); - $index->commit; + if (defined($path)) { + my ($ln, $ns) = $lang->referencefile + ( $pathname + , $path + , $fileid + , $index + , $config + ); + if (0 > $ln) { + # This happens sometimes in CVS + print(STDERR " ${VTred}### FAILED${VTnorm}\n"); + } else { + print(STDERR "+++ $ln/$ns\n"); + } + $index->flushcache(0); + $index->setfilereferenced($fileid); +### The following line is commented out to improve performance. +### The consequence is a higher load on memory since DB updates +### are kept in memory until commit time (at least on directory +### exit). +# $index->commit(); +### This line is ABSOLUTELY mandatory in case multi-thread is publicly released + } else { + print(STDERR " ${VTred}FAILED${VTnorm}\n"); + } $files->releaserealfilename($path); } else { print(STDERR " ${VTyellow}already referenced${VTnorm}\n"); |