mirror of
https://github.com/apache/lucene.git
synced 2025-03-04 07:19:18 +00:00
LUCENE-2791: set the optimal buffersize by default
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1042373 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4e44804c38
commit
0308402397
@ -113,7 +113,7 @@ JNIEXPORT jint JNICALL Java_org_apache_lucene_store_WindowsDirectory_read
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length <= 2048) { /* For small buffers, avoid GetByteArrayElements' copy */
|
if (length <= 4096) { /* For small buffers, avoid GetByteArrayElements' copy */
|
||||||
char buffer[length];
|
char buffer[length];
|
||||||
|
|
||||||
if (ReadFile((HANDLE) fd, &buffer, length, &numRead, &io)) {
|
if (ReadFile((HANDLE) fd, &buffer, length, &numRead, &io)) {
|
||||||
|
@ -38,6 +38,7 @@ import java.io.IOException;
|
|||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
*/
|
*/
|
||||||
public class WindowsDirectory extends FSDirectory {
|
public class WindowsDirectory extends FSDirectory {
|
||||||
|
private static final int DEFAULT_BUFFERSIZE = 4096; /* default pgsize on ia32/amd64 */
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("WindowsDirectory");
|
System.loadLibrary("WindowsDirectory");
|
||||||
@ -65,7 +66,7 @@ public class WindowsDirectory extends FSDirectory {
|
|||||||
|
|
||||||
public IndexInput openInput(String name, int bufferSize) throws IOException {
|
public IndexInput openInput(String name, int bufferSize) throws IOException {
|
||||||
ensureOpen();
|
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 {
|
protected static class WindowsIndexInput extends BufferedIndexInput {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user