From fbfba3bdead99987f9a22c43015f3a7d4232256e Mon Sep 17 00:00:00 2001 From: Scott Crosby Date: Thu, 2 Sep 2010 14:22:41 -0500 Subject: [PATCH] Don't sort the first 127 entries in the string table. Gives a small .1% gain. In my design, I try to use the smallest integers as much as possible so that deflate's entropy coder works more efficiently. --- src.java/crosby/binary/StringTable.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src.java/crosby/binary/StringTable.java b/src.java/crosby/binary/StringTable.java index 7c34dcf..e828720 100644 --- a/src.java/crosby/binary/StringTable.java +++ b/src.java/crosby/binary/StringTable.java @@ -53,7 +53,10 @@ public class StringTable { // Each group of keys that serializes to the same number of bytes is // sorted lexiconographically. // to maximize deflate compression. - Arrays.sort(set, Math.min(0, set.length-1), Math.min(1 << 7, set.length-1)); + + // Don't sort the first array. There's not likely to be much benefit, and we want frequent values to be small. + //Arrays.sort(set, Math.min(0, set.length-1), Math.min(1 << 7, set.length-1)); + Arrays.sort(set, Math.min(1 << 7, set.length-1), Math.min(1 << 14, set.length-1)); Arrays.sort(set, Math.min(1 << 14, set.length-1), Math.min(1 << 21,