couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1136988 - in /couchdb/trunk: configure.ac src/snappy/Makefile.am src/snappy/google-snappy/snappy.cc src/snappy/snappy.app.in
Date Fri, 17 Jun 2011 19:15:55 GMT
Author: fdmanana
Date: Fri Jun 17 19:15:55 2011
New Revision: 1136988

URL: http://svn.apache.org/viewvc?rev=1136988&view=rev
Log:
Upgrade snappy to version 1.0.3

This new version slightly improves decompression speed.
Release notes at:
    http://code.google.com/p/snappy/source/browse/trunk/NEWS


Modified:
    couchdb/trunk/configure.ac
    couchdb/trunk/src/snappy/Makefile.am
    couchdb/trunk/src/snappy/google-snappy/snappy.cc
    couchdb/trunk/src/snappy/snappy.app.in

Modified: couchdb/trunk/configure.ac
URL: http://svn.apache.org/viewvc/couchdb/trunk/configure.ac?rev=1136988&r1=1136987&r2=1136988&view=diff
==============================================================================
--- couchdb/trunk/configure.ac (original)
+++ couchdb/trunk/configure.ac Fri Jun 17 19:15:55 2011
@@ -36,7 +36,7 @@ PKG_PROG_PKG_CONFIG
 dnl Config for google snappy
 m4_define([snappy_major], [1])
 m4_define([snappy_minor], [0])
-m4_define([snappy_patchlevel], [1])
+m4_define([snappy_patchlevel], [3])
 
 AC_PROG_CXX
 AC_LANG([C++])

Modified: couchdb/trunk/src/snappy/Makefile.am
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/snappy/Makefile.am?rev=1136988&r1=1136987&r2=1136988&view=diff
==============================================================================
--- couchdb/trunk/src/snappy/Makefile.am (original)
+++ couchdb/trunk/src/snappy/Makefile.am Fri Jun 17 19:15:55 2011
@@ -10,8 +10,8 @@
 ## License for the specific language governing permissions and limitations under
 ## the License.
 
-snappyebindir = $(localerlanglibdir)/snappy-1.0.1/ebin
-snappyprivdir = $(localerlanglibdir)/snappy-1.0.1/priv
+snappyebindir = $(localerlanglibdir)/snappy-1.0.3/ebin
+snappyprivdir = $(localerlanglibdir)/snappy-1.0.3/priv
 
 snappy_cxx_srcs = \
 	snappy_nif.cc \

Modified: couchdb/trunk/src/snappy/google-snappy/snappy.cc
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/snappy/google-snappy/snappy.cc?rev=1136988&r1=1136987&r2=1136988&view=diff
==============================================================================
--- couchdb/trunk/src/snappy/google-snappy/snappy.cc (original)
+++ couchdb/trunk/src/snappy/google-snappy/snappy.cc Fri Jun 17 19:15:55 2011
@@ -653,44 +653,50 @@ class SnappyDecompressor {
   // Process the next item found in the input.
   // Returns true if successful, false on error or end of input.
   template <class Writer>
-  bool Step(Writer* writer) {
+  void DecompressAllTags(Writer* writer) {
     const char* ip = ip_;
-    if (ip_limit_ - ip < 5) {
-      if (!RefillTag()) return false;
-      ip = ip_;
-    }
+    for ( ;; ) {
+      if (ip_limit_ - ip < 5) {
+        ip_ = ip;
+        if (!RefillTag()) return;
+        ip = ip_;
+      }
 
-    const unsigned char c = *(reinterpret_cast<const unsigned char*>(ip++));
-    const uint32 entry = char_table[c];
-    const uint32 trailer = LittleEndian::Load32(ip) & wordmask[entry >> 11];
-    ip += entry >> 11;
-    const uint32 length = entry & 0xff;
-
-    if ((c & 0x3) == LITERAL) {
-      uint32 literal_length = length + trailer;
-      uint32 avail = ip_limit_ - ip;
-      while (avail < literal_length) {
+      const unsigned char c = *(reinterpret_cast<const unsigned char*>(ip++));
+      const uint32 entry = char_table[c];
+      const uint32 trailer = LittleEndian::Load32(ip) & wordmask[entry >> 11];
+      ip += entry >> 11;
+      const uint32 length = entry & 0xff;
+
+      if ((c & 0x3) == LITERAL) {
+        uint32 literal_length = length + trailer;
+        uint32 avail = ip_limit_ - ip;
+        while (avail < literal_length) {
+          bool allow_fast_path = (avail >= 16);
+          if (!writer->Append(ip, avail, allow_fast_path)) return;
+          literal_length -= avail;
+          reader_->Skip(peeked_);
+          size_t n;
+          ip = reader_->Peek(&n);
+          avail = n;
+          peeked_ = avail;
+          if (avail == 0) return;  // Premature end of input
+          ip_limit_ = ip + avail;
+        }
         bool allow_fast_path = (avail >= 16);
-        if (!writer->Append(ip, avail, allow_fast_path)) return false;
-        literal_length -= avail;
-        reader_->Skip(peeked_);
-        size_t n;
-        ip = reader_->Peek(&n);
-        avail = n;
-        peeked_ = avail;
-        if (avail == 0) return false;  // Premature end of input
-        ip_limit_ = ip + avail;
+        if (!writer->Append(ip, literal_length, allow_fast_path)) {
+          return;
+        }
+        ip += literal_length;
+      } else {
+        // copy_offset/256 is encoded in bits 8..10.  By just fetching
+        // those bits, we get copy_offset (since the bit-field starts at
+        // bit 8).
+        const uint32 copy_offset = entry & 0x700;
+        if (!writer->AppendFromSelf(copy_offset + trailer, length)) {
+          return;
+        }
       }
-      ip_ = ip + literal_length;
-      bool allow_fast_path = (avail >= 16);
-      return writer->Append(ip, literal_length, allow_fast_path);
-    } else {
-      ip_ = ip;
-      // copy_offset/256 is encoded in bits 8..10.  By just fetching
-      // those bits, we get copy_offset (since the bit-field starts at
-      // bit 8).
-      const uint32 copy_offset = entry & 0x700;
-      return writer->AppendFromSelf(copy_offset + trailer, length);
     }
   }
 };
@@ -770,7 +776,7 @@ static bool InternalUncompress(Source* r
   writer->SetExpectedLength(uncompressed_len);
 
   // Process the entire input
-  while (decompressor.Step(writer)) { }
+  decompressor.DecompressAllTags(writer);
   return (decompressor.eof() && writer->CheckLength());
 }
 
@@ -866,7 +872,7 @@ size_t Compress(Source* reader, Sink* wr
 
 // A type that writes to a flat array.
 // Note that this is not a "ByteSink", but a type that matches the
-// Writer template argument to SnappyDecompressor::Step().
+// Writer template argument to SnappyDecompressor::DecompressAllTags().
 class SnappyArrayWriter {
  private:
   char* base_;

Modified: couchdb/trunk/src/snappy/snappy.app.in
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/snappy/snappy.app.in?rev=1136988&r1=1136987&r2=1136988&view=diff
==============================================================================
--- couchdb/trunk/src/snappy/snappy.app.in (original)
+++ couchdb/trunk/src/snappy/snappy.app.in Fri Jun 17 19:15:55 2011
@@ -1,7 +1,7 @@
 {application, snappy,
  [
   {description, "snappy compressor/decompressor Erlang NIF wrapper"},
-  {vsn, "1.0.1"},
+  {vsn, "1.0.3"},
   {registered, []},
   {applications, [
                   kernel,



Mime
View raw message