Index: lucene/src/test/org/apache/lucene/index/TestByteSlices.java
===================================================================
--- lucene/src/test/org/apache/lucene/index/TestByteSlices.java	(revision 1050918)
+++ lucene/src/test/org/apache/lucene/index/TestByteSlices.java	(working copy)
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-import java.util.concurrent.locks.ReentrantLock;
-
 import org.apache.lucene.util.ByteBlockPool;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.RecyclingByteBlockAllocator;
@@ -49,7 +47,7 @@
           System.out.println("write stream=" + stream);
 
         if (starts[stream] == -1) {
-          final int spot = pool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);
+          final int spot = pool.newSliceByLevel(0);
           starts[stream] = uptos[stream] = spot + pool.byteOffset;
           if (VERBOSE)
             System.out.println("  init to " + starts[stream]);
Index: lucene/src/java/org/apache/lucene/index/TermsHashPerField.java
===================================================================
--- lucene/src/java/org/apache/lucene/index/TermsHashPerField.java	(revision 1050918)
+++ lucene/src/java/org/apache/lucene/index/TermsHashPerField.java	(working copy)
@@ -156,7 +156,7 @@
       postingsArray.intStarts[termID] = intUptoStart + intPool.intOffset;
 
       for(int i=0;i<streamCount;i++) {
-        final int upto = bytePool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);
+        final int upto = bytePool.newSliceByLevel(0);
         intUptos[intUptoStart+i] = upto + bytePool.byteOffset;
       }
       postingsArray.byteStarts[termID] = intUptos[intUptoStart];
@@ -219,7 +219,7 @@
       postingsArray.intStarts[termID] = intUptoStart + intPool.intOffset;
 
       for(int i=0;i<streamCount;i++) {
-        final int upto = bytePool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);
+        final int upto = bytePool.newSliceByLevel(0);
         intUptos[intUptoStart+i] = upto + bytePool.byteOffset;
       }
       postingsArray.byteStarts[termID] = intUptos[intUptoStart];
Index: lucene/src/java/org/apache/lucene/util/ByteBlockPool.java
===================================================================
--- lucene/src/java/org/apache/lucene/util/ByteBlockPool.java	(revision 1050918)
+++ lucene/src/java/org/apache/lucene/util/ByteBlockPool.java	(working copy)
@@ -18,6 +18,7 @@
  */
 import java.util.Arrays;
 import java.util.List;
+
 import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF;
 
 /** 
@@ -84,6 +85,8 @@
   int bufferUpto = -1;                        // Which buffer we are upto
   public int byteUpto = BYTE_BLOCK_SIZE;             // Where we are in head buffer
 
+  public int byteSliceUpto = BYTE_BLOCK_SIZE;
+  
   public byte[] buffer;                              // Current head buffer
   public int byteOffset = -BYTE_BLOCK_SIZE;          // Current head offset
 
@@ -112,6 +115,7 @@
       bufferUpto = 0;
       byteUpto = 0;
       byteOffset = 0;
+      byteSliceUpto = 0;
       buffer = buffers[0];
     }
   }
@@ -127,15 +131,21 @@
     bufferUpto++;
 
     byteUpto = 0;
+    byteSliceUpto = 0;
     byteOffset += BYTE_BLOCK_SIZE;
   }
 
-  public int newSlice(final int size) {
+  public int newSliceByLevel(final int level) {
+    int size = levelSizeArray[level];
     if (byteUpto > BYTE_BLOCK_SIZE-size)
       nextBuffer();
     final int upto = byteUpto;
+    
     byteUpto += size;
-    buffer[byteUpto-1] = 16;
+    
+    byteSliceUpto = byteUpto - 3;
+    
+    buffer[byteSliceUpto-1] = 16;
     return upto;
   }
 
@@ -144,11 +154,10 @@
   // is just a compact way to encode X+1 with a max.  Second
   // array is the length of each slice, ie first slice is 5
   // bytes, next slice is 14 bytes, etc.
+  public final static int[] nextLevelArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9};
+  public final static int[] levelSizeArray = {9, 14, 20, 30, 40, 40, 80, 80, 120, 200};
+  final static int FIRST_LEVEL_SIZE = levelSizeArray[0];
   
-  public final static int[] nextLevelArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9};
-  public final static int[] levelSizeArray = {5, 14, 20, 30, 40, 40, 80, 80, 120, 200};
-  public final static int FIRST_LEVEL_SIZE = levelSizeArray[0];
-
   public int allocSlice(final byte[] slice, final int upto) {
 
     final int level = slice[upto] & 15;
@@ -160,30 +169,26 @@
       nextBuffer();
 
     final int newUpto = byteUpto;
-    final int offset = newUpto + byteOffset;
+    final int offset = byteUpto + byteOffset;
+    
     byteUpto += newSize;
-
-    // Copy forward the past 3 bytes (which we are about
-    // to overwrite with the forwarding address):
-    buffer[newUpto] = slice[upto-3];
-    buffer[newUpto+1] = slice[upto-2];
-    buffer[newUpto+2] = slice[upto-1];
-
-    // Write forwarding address at end of last slice:
-    slice[upto-3] = (byte) (offset >>> 24);
-    slice[upto-2] = (byte) (offset >>> 16);
-    slice[upto-1] = (byte) (offset >>> 8);
-    slice[upto] = (byte) offset;
-        
+    
+    slice[upto] = (byte) (offset >>> 24);
+    slice[upto+1] = (byte) (offset >>> 16);
+    slice[upto+2] = (byte) (offset >>> 8);
+    slice[upto+3] = (byte) offset;
+    
+    byteSliceUpto = byteUpto - 3;
+    
     // Write new level:
-    buffer[byteUpto-1] = (byte) (16|newLevel);
+    buffer[byteSliceUpto-1] = (byte) (16|newLevel);
 
-    return newUpto+3;
+    return newUpto;
   }
 
   // Fill in a BytesRef from term's length & bytes encoded in
   // byte block
-  public final BytesRef setBytesRef(BytesRef term, int textStart) {
+  final BytesRef setBytesRef(BytesRef term, int textStart) {
     final byte[] bytes = term.bytes = buffers[textStart >> BYTE_BLOCK_SHIFT];
     int pos = textStart & BYTE_BLOCK_MASK;
     if ((bytes[pos] & 0x80) == 0) {
