aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-10-12 08:55:19 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2022-10-12 09:12:05 +0200
commit1cb581c8873591316fd20927931e24efc3e5837d (patch)
tree878d779e55224791e199a2ca4326d8983aca8fa9 /vespajlib
parent09489728d0912761649106f00d7837281b272a76 (diff)
- Use a common scratchpad for serializing the different parts of the query.
- Use a threadlocal for the scratchpad. This avoids costly resizing, or initialiing too large buffer for every query. Using a thread local is fine now that we limit the number of search threads to a reasonable number = #cores * 2.
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java b/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
index cf728d69d18..479375d6b74 100644
--- a/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
+++ b/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
@@ -90,7 +90,7 @@ public class GrowableByteBuffer implements Comparable<GrowableByteBuffer> {
//ByteBuffers and keep track of global position etc., much like
//GrowableBufferOutputStream does it.
- protected void grow(int newSize) {
+ public void grow(int newSize) {
//create new buffer:
ByteBuffer newByteBuf;
if (buffer.isDirect()) {
@@ -104,7 +104,7 @@ public class GrowableByteBuffer implements Comparable<GrowableByteBuffer> {
//copy old contents and set correct position:
int oldPos = buffer.position();
newByteBuf.position(0);
- buffer.position(0);
+ buffer.flip();
newByteBuf.put(buffer);
newByteBuf.position(oldPos);