mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
Memory alignment tweaks for better performance (#22)
Co-authored-by: vlofgren <vlofgren@gmail.com> Reviewed-on: https://git.marginalia.nu/marginalia/marginalia.nu/pulls/22
This commit is contained in:
parent
c7a095e497
commit
fcd2708fe3
@ -52,14 +52,15 @@ public class MultimapFileLong implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int getBufferSize(long totalSize, boolean write) {
|
private static int getBufferSize(long totalSize, boolean write) {
|
||||||
|
int defaultBig = 2<<23;
|
||||||
if (totalSize > Integer.MAX_VALUE/WORD_SIZE) {
|
if (totalSize > Integer.MAX_VALUE/WORD_SIZE) {
|
||||||
return (int)(Integer.MAX_VALUE/WORD_SIZE);
|
return defaultBig;
|
||||||
}
|
}
|
||||||
else if (write && totalSize < 8*1024*1024) {
|
else if (write && totalSize < 8*1024*1024) {
|
||||||
return 8*1024*1024;
|
return 8*1024*1024;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (int) Math.min(totalSize, Integer.MAX_VALUE/WORD_SIZE);
|
return (int) Math.min(totalSize, defaultBig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user