uschindler commented on code in PR #14705: URL: https://github.com/apache/lucene/pull/14705#discussion_r2105059932
########## lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundFormat.java: ########## @@ -105,29 +107,18 @@ public void write(Directory dir, SegmentInfo si, IOContext context) throws IOExc private record SizedFile(String name, long length) {} - private static class SizedFileQueue extends PriorityQueue<SizedFile> { - SizedFileQueue(int maxSize) { - super(maxSize); - } - - @Override - protected boolean lessThan(SizedFile sf1, SizedFile sf2) { - return sf1.length < sf2.length; - } - } - private void writeCompoundFile( IndexOutput entries, IndexOutput data, Directory dir, SegmentInfo si) throws IOException { // write number of files int numFiles = si.files().size(); entries.writeVInt(numFiles); // first put files in ascending size order so small files fit more likely into one page - SizedFileQueue pq = new SizedFileQueue(numFiles); + List<SizedFile> files = new ArrayList<>(numFiles); Review Comment: Sorting should also be faster here. The Lucene PQ is only needed when items in queue should fall out at botton when its full. In other cases the ln-overhaed is larger than a simple sorting at end. -- 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