You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2010/12/05 16:24:34 UTC

svn commit: r1042373 - in /lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store: WindowsDirectory.cpp WindowsDirectory.java

Author: rmuir
Date: Sun Dec  5 15:24:34 2010
New Revision: 1042373

URL: http://svn.apache.org/viewvc?rev=1042373&view=rev
Log:
LUCENE-2791: set the optimal buffersize by default

Modified:
    lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp
    lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java

Modified: lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp?rev=1042373&r1=1042372&r2=1042373&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp (original)
+++ lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.cpp Sun Dec  5 15:24:34 2010
@@ -113,7 +113,7 @@ JNIEXPORT jint JNICALL Java_org_apache_l
     return -1;
   }
   
-  if (length <= 2048) {  /* For small buffers, avoid GetByteArrayElements' copy */
+  if (length <= 4096) {  /* For small buffers, avoid GetByteArrayElements' copy */
     char buffer[length];
   	
     if (ReadFile((HANDLE) fd, &buffer, length, &numRead, &io)) {

Modified: lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java?rev=1042373&r1=1042372&r2=1042373&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java (original)
+++ lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java Sun Dec  5 15:24:34 2010
@@ -38,6 +38,7 @@ import java.io.IOException;
  * @lucene.experimental
  */
 public class WindowsDirectory extends FSDirectory {
+  private static final int DEFAULT_BUFFERSIZE = 4096; /* default pgsize on ia32/amd64 */
   
   static {
     System.loadLibrary("WindowsDirectory");
@@ -65,7 +66,7 @@ public class WindowsDirectory extends FS
 
   public IndexInput openInput(String name, int bufferSize) throws IOException {
     ensureOpen();
-    return new WindowsIndexInput(new File(getDirectory(), name), bufferSize);
+    return new WindowsIndexInput(new File(getDirectory(), name), Math.max(bufferSize, DEFAULT_BUFFERSIZE));
   }
   
   protected static class WindowsIndexInput extends BufferedIndexInput {