You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2021/08/26 14:02:15 UTC

[lucene-solr] branch branch_8x updated: LUCENE-9917: Smaller block sizes for BEST_SPEED. (#257)

This is an automated email from the ASF dual-hosted git repository.

jpountz pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 37368d3  LUCENE-9917: Smaller block sizes for BEST_SPEED. (#257)
37368d3 is described below

commit 37368d3e405c6de3119c035d7cb7dec0f28c8a67
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Thu Aug 26 15:59:17 2021 +0200

    LUCENE-9917: Smaller block sizes for BEST_SPEED. (#257)
    
    This reduces the block size for BEST_SPEED in order to trade some compression
    ratio in exchange for better retrieval speed.
---
 lucene/CHANGES.txt                                                    | 3 +++
 .../lucene/codecs/lucene87/LZ4WithPresetDictCompressionMode.java      | 4 ++--
 .../org/apache/lucene/codecs/lucene87/Lucene87StoredFieldsFormat.java | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index db8f924..3414448 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -71,6 +71,9 @@ Improvements
 
 * LUCENE-5309: Optimize facet counting for single-valued SSDV / StringValueFacetCounts. (Greg Miller)
 
+* LUCENE-9917: The BEST_SPEED compression mode now trades more compression ratio
+  in exchange of faster reads. (Adrien Grand)
+
 Optimizations
 ---------------------
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene87/LZ4WithPresetDictCompressionMode.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene87/LZ4WithPresetDictCompressionMode.java
index 15b961d..689e215 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene87/LZ4WithPresetDictCompressionMode.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene87/LZ4WithPresetDictCompressionMode.java
@@ -38,8 +38,8 @@ public final class LZ4WithPresetDictCompressionMode extends CompressionMode {
 
   // Shoot for 10 sub blocks
   private static final int NUM_SUB_BLOCKS = 10;
-  // And a dictionary whose size is about 16x smaller than sub blocks
-  private static final int DICT_SIZE_FACTOR = 16;
+  // And a dictionary whose size is about 2x smaller than sub blocks
+  private static final int DICT_SIZE_FACTOR = 2;
 
   /** Sole constructor. */
   public LZ4WithPresetDictCompressionMode() {}
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene87/Lucene87StoredFieldsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene87/Lucene87StoredFieldsFormat.java
index 1432df8..37e0e4c 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene87/Lucene87StoredFieldsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene87/Lucene87StoredFieldsFormat.java
@@ -157,8 +157,8 @@ public class Lucene87StoredFieldsFormat extends StoredFieldsFormat {
   /** Compression mode for {@link Mode#BEST_COMPRESSION} */
   public static final CompressionMode BEST_COMPRESSION_MODE = new DeflateWithPresetDictCompressionMode();
 
-  // Shoot for 10 sub blocks of 60kB each.
-  private static final int BEST_SPEED_BLOCK_LENGTH = 10 * 60 * 1024;
+  // Shoot for 10 sub blocks of 8kB each.
+  private static final int BEST_SPEED_BLOCK_LENGTH = 10 * 8 * 1024;
 
   /** Compression mode for {@link Mode#BEST_SPEED} */
   public static final CompressionMode BEST_SPEED_MODE = new LZ4WithPresetDictCompressionMode();