msfroh commented on code in PR #13054:
URL: https://github.com/apache/lucene/pull/13054#discussion_r1701025192


##########
lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMapDirectory.java:
##########
@@ -0,0 +1,191 @@
+/*
+ * 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.analysis.synonym;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.List;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexInput;
+import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.fst.ByteSequenceOutputs;
+import org.apache.lucene.util.fst.FST;
+import org.apache.lucene.util.fst.OffHeapFSTStore;
+
+/**
+ * Wraps an {@link FSDirectory} to read and write a compiled {@link 
SynonymMap}. When reading, the
+ * FST and output words are kept off-heap.

Review Comment:
   At this point, if you're using `SynonymMapDirectory`, you get off-heap FST 
and on-heap words.
   
   If you don't use `SynonymMapDirectory` (i.e. you're using the existing 
constructor or the arg-less version of `SynonymMap.Builder.build()`), then 
everything is on-heap like before.
   
   The numbers I posted in 
https://github.com/apache/lucene/pull/13054#issuecomment-1935491971 (which, 
granted, was just a single synthetic benchmark) seemed to suggest (to me, at 
least) that the "sweet spot" is off-heap FST with on-heap words. The 
performance hit from moving words off-heap (at least with my implementation) 
was pretty bad. Lots of `seek`ing involved. Also, the vast majority of heap 
savings came from moving the FST.
   
   I'm happy to bring back off-heap words as an option if we think someone 
would be willing to take that perf hit for slightly lower heap utilization.



-- 
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

Reply via email to