jpountz commented on PR #12114:
URL: https://github.com/apache/lucene/pull/12114#issuecomment-1406248901

   Here is the synthetic benchmark that I used if someone is interested in 
reproducing:
   
   ```java
     enum Order {
       RANDOM,
       ASC,
       DESC;
     }
   
     public static void main(String[] args) throws IOException {
       Order order = Order.RANDOM;
       Directory dir = FSDirectory.open(Paths.get("/tmp/a"));
       IndexWriterConfig cfg = new IndexWriterConfig(null);
       cfg.setInfoStream(new PrintStreamInfoStream(System.out));
       cfg.setMaxBufferedDocs(100_000);
       cfg.setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH);
       cfg.setIndexSort(new Sort(LongField.newSortField("sort_field", false, 
SortedNumericSelector.Type.MIN)));
       IndexWriter w = new IndexWriter(dir, cfg);
       Document doc = new Document();
       LongField sortField = new LongField("sort_field", 0);
       doc.add(sortField);
       StringField stringField1 = new StringField("string_field", "", Store.NO);
       doc.add(stringField1);
       StringField stringField2 = new StringField("string_field", "", Store.NO);
       doc.add(stringField2);
       StringField stringField3 = new StringField("string_field", "", Store.NO);
       doc.add(stringField3);
       for (int i = 0; i < 5_000_000; ++i) {
         long sortValue = switch (order) {
         case RANDOM -> i % 15;
         case ASC -> i;
         case DESC -> -i;
         };
         sortField.setLongValue(sortValue);
         stringField1.setStringValue(Integer.toBinaryString(i % 10));
         stringField2.setStringValue(Integer.toBinaryString(i % 100));
         stringField3.setStringValue(Integer.toBinaryString(i % 1000));
         w.addDocument(doc);
       }
     }
   ```
   
   And flush times for postings:
   
   | | Main  | Patch |
   | ------ | ------------- | ------------- |
   | Index sort matches indexing order | 6 | 7  |
   | Index sort is reverse indexing order | 7  | 8  |
   | Random sort | 27 | 10 |


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