reduce mem buffer overhead for gap files during r/w

(they are typically small compared to idx allowing to use smaller buffersize -> set to 16k records)
pull/1/head
reger 11 years ago
parent 8d1b764458
commit ea6c9e9b07

@ -63,7 +63,7 @@ public class Gap extends TreeMap<Long, Integer> {
// read the index dump and fill the index // read the index dump and fill the index
DataInputStream is; DataInputStream is;
try { try {
is = new DataInputStream(new BufferedInputStream(new FileInputStream(file), 1024 * 1024)); is = new DataInputStream(new BufferedInputStream(new FileInputStream(file), (Integer.SIZE + Long.SIZE) * 1024)); // equals 16*1024*recordsize
} catch (final OutOfMemoryError e) { } catch (final OutOfMemoryError e) {
is = new DataInputStream(new FileInputStream(file)); is = new DataInputStream(new FileInputStream(file));
} }
@ -93,7 +93,7 @@ public class Gap extends TreeMap<Long, Integer> {
Iterator<Map.Entry<Long, Integer>> i = this.entrySet().iterator(); Iterator<Map.Entry<Long, Integer>> i = this.entrySet().iterator();
DataOutputStream os; DataOutputStream os;
try { try {
os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(tmp), 4 * 1024 * 1024)); os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(tmp), (Integer.SIZE + Long.SIZE) * 1024)); // = 16*1024*recordsize
} catch (final OutOfMemoryError e) { } catch (final OutOfMemoryError e) {
os = new DataOutputStream(new FileOutputStream(tmp)); os = new DataOutputStream(new FileOutputStream(tmp));
} }

Loading…
Cancel
Save