[ 
https://issues.apache.org/jira/browse/LUCENE-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269604#comment-13269604
 ] 

Shai Erera commented on LUCENE-4039:
------------------------------------

I ran a small benchmark over an index with 1M documents, that was generated 
using that .alg file:

{code}
writer.version=LUCENE_40
ram.flush.mb=128
analyzer=org.apache.lucene.analysis.core.WhitespaceAnalyzer
directory=FSDirectory
work.dir=input
doc.stored=false
doc.tokenized=true
doc.term.vector=false
log.step=20000
content.source=org.apache.lucene.benchmark.byTask.feeds.SingleDocSource
task.max.depth.log=2

# ----------------------------------------------------------------------------
ResetSystemErase
CreateIndex
[ { "AddDocs" AddDoc > : 125000 ] : 8
CloseIndex
RepSumByName
{code}

Then I ran the following addIndexes.alg file

{code}
writer.version=LUCENE_40
analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
directory=FSDirectory
work.dir=output
task.max.depth.log=2

# directory to add to the target index
addindexes.input.dir=input/index

# -----------------------------------------------------------------------

# call addIndexes (Directory)
ResetSystemErase
CreateIndex
{ "AddIndexesDirectory" AddIndexes(true) >
CloseIndex

# call addIndexes (IndexReader)
ResetSystemErase
CreateIndex
{ "AddIndexesReader" AddIndexes(false) >
CloseIndex

RepSumByPref AddIndexes
{code}

The run reports:

{code}
------------> Report Sum By Prefix (AddIndexes) (2 about 2 out of 7)
Operation           round   runCnt   recsPerRun        rec/s  elapsedSec    
avgUsedMem    avgTotalMem
AddIndexesDirectory     0        1            1         1.33        0.75     
3,873,528      4,194,304
AddIndexesReader        0        1            1         0.06       17.82     
5,795,936      7,906,304
{code}

To highlight, the addIndexes(Directory) version is x23 faster than 
addIndexes(IndexReader), and that's on a fairly small and simple index (376 MB, 
not so many posting lists). That means that on a more complex index, with more 
posting lists, more CPU encoding/decoding work will happen, while I suspect the 
raw file-system file copies done in addIndexes(Dir) will not be affected much.

This shows how important it is to use addIndexes(Dir) whenever possible ...
                
> Add AddIndexesTask to Benchmark
> -------------------------------
>
>                 Key: LUCENE-4039
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4039
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: modules/benchmark
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-4039.patch
>
>
> I was interested in measuring the performance of 
> IndexWriter.addIndexes(Directory) vs. IndexWriter.addIndexes(IndexReader). I 
> wrote an AddIndexesTask and a matching .alg. The task takes a parameter 
> whether to use the IndexReader or Directory variants. I'll upload the patch 
> and describe the perf results.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to