You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by mi...@apache.org on 2006/11/17 12:18:12 UTC
svn commit: r476110 - in /lucene/java/trunk: CHANGES.txt
src/java/org/apache/lucene/index/DocumentWriter.java
Author: mikemccand
Date: Fri Nov 17 03:18:11 2006
New Revision: 476110
URL: http://svn.apache.org/viewvc?view=rev&rev=476110
Log:
Optimization: call System.arraycopy instead of manual for loop copying
Modified:
lucene/java/trunk/CHANGES.txt
lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java
Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=476110&r1=476109&r2=476110
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Fri Nov 17 03:18:11 2006
@@ -221,6 +221,9 @@
queries involving term positions, including phrase queries.
(Michael Busch via Yonik Seeley)
+ 12. LUCENE-714: Replaced 2 cases of manual for-loop array copying
+ with calls to System.arraycopy instead, in DocumentWriter.java.
+ (Nicolas Lalevee via Mike McCandless)
Test Cases
1. Added TestTermScorer.java (Grant Ingersoll)
Modified: lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java?view=diff&rev=476110&r1=476109&r2=476110
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java Fri Nov 17 03:18:11 2006
@@ -206,8 +206,7 @@
if (ti.positions.length == freq) { // positions array is full
int[] newPositions = new int[freq * 2]; // double size
int[] positions = ti.positions;
- for (int i = 0; i < freq; i++) // copy old positions to new
- newPositions[i] = positions[i];
+ System.arraycopy(positions, 0, newPositions, 0, freq);
ti.positions = newPositions;
}
ti.positions[freq] = position; // add new position
@@ -216,10 +215,7 @@
if (ti.offsets.length == freq){
TermVectorOffsetInfo [] newOffsets = new TermVectorOffsetInfo[freq*2];
TermVectorOffsetInfo [] offsets = ti.offsets;
- for (int i = 0; i < freq; i++)
- {
- newOffsets[i] = offsets[i];
- }
+ System.arraycopy(offsets, 0, newOffsets, 0, freq);
ti.offsets = newOffsets;
}
ti.offsets[freq] = offset;