lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yueyu Lin (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENE-568) [PATCH]Multiple threads performance enhancement when querying.
Date Wed, 10 May 2006 02:21:04 GMT
[PATCH]Multiple threads performance enhancement when querying.
--------------------------------------------------------------

         Key: LUCENE-568
         URL: http://issues.apache.org/jira/browse/LUCENE-568
     Project: Lucene - Java
        Type: Improvement

  Components: Search  
    Versions: 1.9    
 Environment: OS: Red Hat EL 3
Machine: Dual CPUs, 1024M Ram, 100Giga bytes SCSI disks.
Lucene 1.9.1
JVM:JDK1.5.06
    Reporter: Yueyu Lin


This improvement will reduce the wait when TermInfosReader calls ensureIndexIsRead().
The small trick like below:
  ....
    private void ensureIndexIsRead() throws IOException {
    if (indexTerms != null)                       // index already read
      return;                                     // do nothing
    synchronized(this){
        System.out.println("Read index@--@");
        if(indexTerms != null){
            System.out.println ("Someone read it.return-_-");
            return ;
        }
        readIndex ();
    }
  }
 
  private synchronized void readIndex() throws IOException{
      Term[] m_indexTerms = null;
      try {
          int indexSize = (int)indexEnum.size;        // otherwise read index
          m_indexTerms = new Term[indexSize];
          indexInfos = new TermInfo[indexSize];
          indexPointers = new long[indexSize];

          for (int i = 0; indexEnum.next(); i++) {
            m_indexTerms[i] = indexEnum.term();
            indexInfos[i] = indexEnum.termInfo();
            indexPointers[i] = indexEnum.indexPointer;
          }
        } finally {
            indexEnum.close();
            indexEnum = null;
            indexTerms = m_indexTerms;
        }
  }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message