iverase commented on code in PR #12506: URL: https://github.com/apache/lucene/pull/12506#discussion_r1369987969
########## lucene/core/src/java/org/apache/lucene/util/ByteSlicePool.java: ########## @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.util; + +/** + * Class that Posting and PostingVector use to write byte streams into shared fixed-size byte[] + * arrays. The idea is to allocate slices of increasing lengths For example, the first slice is 5 + * bytes, the next slice is 14, etc. We start by writing our bytes into the first 5 bytes. When we + * hit the end of the slice, we allocate the next slice and then write the address of the new slice + * into the last 4 bytes of the previous slice (the "forwarding address"). + * + * <p>Each slice is filled with 0's initially, and we mark the end with a non-zero byte. This way + * the methods that are writing into the slice don't need to record its length and instead allocate + * a new slice once they hit a non-zero byte. + * + * @lucene.internal + */ +public class ByteSlicePool { Review Comment: maybe move this class to `org.apache.lucene.index` and be package private? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org