zhaih commented on code in PR #12660: URL: https://github.com/apache/lucene/pull/12660#discussion_r1367952944
########## lucene/core/src/java/org/apache/lucene/codecs/lucene95/Lucene95HnswVectorsWriter.java: ########## @@ -50,13 +72,24 @@ public final class Lucene95HnswVectorsWriter extends KnnVectorsWriter { private final IndexOutput meta, vectorData, vectorIndex; private final int M; private final int beamWidth; + private final int numMergeWorkers; + private final ExecutorService exec; private final List<FieldWriter<?>> fields = new ArrayList<>(); private boolean finished; - Lucene95HnswVectorsWriter(SegmentWriteState state, int M, int beamWidth) throws IOException { + Lucene95HnswVectorsWriter(SegmentWriteState state, int M, int beamWidth, int numMergeWorkers) + throws IOException { this.M = M; this.beamWidth = beamWidth; + this.numMergeWorkers = numMergeWorkers; + if (numMergeWorkers <= 1) { + exec = null; + } else { + exec = + Executors.newFixedThreadPool( + Runtime.getRuntime().availableProcessors(), new NamedThreadFactory("hnsw-merge")); Review Comment: Yeah you're right. BTW I'm thinking whether it will be better to have a big threadpool at the Format class and pass it in to every writer? -- 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