snappy 0.0.17 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/.dockerignore +2 -0
  3. data/.github/workflows/main.yml +34 -0
  4. data/.github/workflows/publish.yml +34 -0
  5. data/.gitignore +2 -1
  6. data/.gitmodules +1 -1
  7. data/Dockerfile +13 -0
  8. data/Gemfile +4 -0
  9. data/README.md +29 -5
  10. data/Rakefile +32 -29
  11. data/ext/api.c +6 -1
  12. data/ext/extconf.rb +23 -16
  13. data/lib/snappy/hadoop/reader.rb +62 -0
  14. data/lib/snappy/hadoop/writer.rb +51 -0
  15. data/lib/snappy/hadoop.rb +22 -0
  16. data/lib/snappy/reader.rb +14 -10
  17. data/lib/snappy/shim.rb +1 -1
  18. data/lib/snappy/version.rb +1 -1
  19. data/lib/snappy.rb +5 -4
  20. data/snappy.gemspec +13 -13
  21. data/test/hadoop/snappy_hadoop_reader_test.rb +115 -0
  22. data/test/hadoop/snappy_hadoop_writer_test.rb +48 -0
  23. data/test/snappy_hadoop_test.rb +26 -0
  24. data/test/snappy_reader_test.rb +148 -0
  25. data/test/snappy_test.rb +95 -0
  26. data/test/snappy_writer_test.rb +55 -0
  27. data/test/test_helper.rb +7 -0
  28. data/test.sh +3 -0
  29. data/vendor/snappy/CMakeLists.txt +297 -0
  30. data/vendor/snappy/CONTRIBUTING.md +26 -0
  31. data/vendor/snappy/NEWS +40 -0
  32. data/vendor/snappy/{README → README.md} +27 -18
  33. data/vendor/snappy/cmake/SnappyConfig.cmake.in +33 -0
  34. data/vendor/snappy/cmake/config.h.in +62 -0
  35. data/vendor/snappy/docs/README.md +72 -0
  36. data/vendor/snappy/snappy-internal.h +22 -18
  37. data/vendor/snappy/snappy-stubs-internal.cc +1 -1
  38. data/vendor/snappy/snappy-stubs-internal.h +116 -38
  39. data/vendor/snappy/snappy-stubs-public.h.in +20 -46
  40. data/vendor/snappy/snappy-test.cc +26 -22
  41. data/vendor/snappy/snappy-test.h +24 -98
  42. data/vendor/snappy/snappy.cc +380 -183
  43. data/vendor/snappy/snappy.h +14 -10
  44. data/vendor/snappy/snappy_compress_fuzzer.cc +59 -0
  45. data/vendor/snappy/snappy_uncompress_fuzzer.cc +57 -0
  46. data/vendor/snappy/snappy_unittest.cc +236 -261
  47. metadata +37 -92
  48. data/.travis.yml +0 -26
  49. data/smoke.sh +0 -8
  50. data/test/test-snappy-reader.rb +0 -129
  51. data/test/test-snappy-writer.rb +0 -55
  52. data/test/test-snappy.rb +0 -58
  53. data/vendor/snappy/ChangeLog +0 -2468
  54. data/vendor/snappy/INSTALL +0 -370
  55. data/vendor/snappy/Makefile +0 -982
  56. data/vendor/snappy/Makefile.am +0 -26
  57. data/vendor/snappy/Makefile.in +0 -982
  58. data/vendor/snappy/aclocal.m4 +0 -9738
  59. data/vendor/snappy/autogen.sh +0 -12
  60. data/vendor/snappy/autom4te.cache/output.0 +0 -18856
  61. data/vendor/snappy/autom4te.cache/output.1 +0 -18852
  62. data/vendor/snappy/autom4te.cache/requests +0 -297
  63. data/vendor/snappy/autom4te.cache/traces.0 +0 -2689
  64. data/vendor/snappy/autom4te.cache/traces.1 +0 -714
  65. data/vendor/snappy/config.guess +0 -1530
  66. data/vendor/snappy/config.h +0 -135
  67. data/vendor/snappy/config.h.in +0 -134
  68. data/vendor/snappy/config.log +0 -1640
  69. data/vendor/snappy/config.status +0 -2318
  70. data/vendor/snappy/config.sub +0 -1773
  71. data/vendor/snappy/configure +0 -18852
  72. data/vendor/snappy/configure.ac +0 -134
  73. data/vendor/snappy/depcomp +0 -688
  74. data/vendor/snappy/install-sh +0 -527
  75. data/vendor/snappy/libtool +0 -10246
  76. data/vendor/snappy/ltmain.sh +0 -9661
  77. data/vendor/snappy/m4/gtest.m4 +0 -74
  78. data/vendor/snappy/m4/libtool.m4 +0 -8001
  79. data/vendor/snappy/m4/ltoptions.m4 +0 -384
  80. data/vendor/snappy/m4/ltsugar.m4 +0 -123
  81. data/vendor/snappy/m4/ltversion.m4 +0 -23
  82. data/vendor/snappy/m4/lt~obsolete.m4 +0 -98
  83. data/vendor/snappy/missing +0 -331
  84. data/vendor/snappy/snappy-stubs-public.h +0 -100
  85. data/vendor/snappy/snappy.pc +0 -10
  86. data/vendor/snappy/snappy.pc.in +0 -10
  87. data/vendor/snappy/stamp-h1 +0 -1
@@ -0,0 +1,297 @@
1
+ # Copyright 2019 Google Inc. All Rights Reserved.
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are
5
+ # met:
6
+ #
7
+ # * Redistributions of source code must retain the above copyright
8
+ # notice, this list of conditions and the following disclaimer.
9
+ # * Redistributions in binary form must reproduce the above
10
+ # copyright notice, this list of conditions and the following disclaimer
11
+ # in the documentation and/or other materials provided with the
12
+ # distribution.
13
+ # * Neither the name of Google Inc. nor the names of its
14
+ # contributors may be used to endorse or promote products derived from
15
+ # this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ cmake_minimum_required(VERSION 3.1)
30
+ project(Snappy VERSION 1.1.8 LANGUAGES C CXX)
31
+
32
+ # C++ standard can be overridden when this is used as a sub-project.
33
+ if(NOT CMAKE_CXX_STANDARD)
34
+ # This project requires C++11.
35
+ set(CMAKE_CXX_STANDARD 11)
36
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
37
+ set(CMAKE_CXX_EXTENSIONS OFF)
38
+ endif(NOT CMAKE_CXX_STANDARD)
39
+
40
+ # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
41
+ # it prominent in the GUI.
42
+ option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
43
+
44
+ option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
45
+
46
+ option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
47
+
48
+ option(SNAPPY_REQUIRE_AVX "Target processors with AVX support." OFF)
49
+
50
+ option(SNAPPY_REQUIRE_AVX2 "Target processors with AVX2 support." OFF)
51
+
52
+ option(SNAPPY_INSTALL "Install Snappy's header and library" ON)
53
+
54
+ include(TestBigEndian)
55
+ test_big_endian(SNAPPY_IS_BIG_ENDIAN)
56
+
57
+ include(CheckIncludeFile)
58
+ check_include_file("byteswap.h" HAVE_BYTESWAP_H)
59
+ check_include_file("sys/endian.h" HAVE_SYS_ENDIAN_H)
60
+ check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
61
+ check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
62
+ check_include_file("sys/time.h" HAVE_SYS_TIME_H)
63
+ check_include_file("sys/uio.h" HAVE_SYS_UIO_H)
64
+ check_include_file("unistd.h" HAVE_UNISTD_H)
65
+ check_include_file("windows.h" HAVE_WINDOWS_H)
66
+
67
+ include(CheckLibraryExists)
68
+ check_library_exists(z zlibVersion "" HAVE_LIBZ)
69
+ check_library_exists(lzo2 lzo1x_1_15_compress "" HAVE_LIBLZO2)
70
+
71
+ include(CheckCXXCompilerFlag)
72
+ CHECK_CXX_COMPILER_FLAG("/arch:AVX" HAVE_VISUAL_STUDIO_ARCH_AVX)
73
+ CHECK_CXX_COMPILER_FLAG("/arch:AVX2" HAVE_VISUAL_STUDIO_ARCH_AVX2)
74
+ CHECK_CXX_COMPILER_FLAG("-mavx" HAVE_CLANG_MAVX)
75
+ CHECK_CXX_COMPILER_FLAG("-mbmi2" HAVE_CLANG_MBMI2)
76
+ if(SNAPPY_REQUIRE_AVX2)
77
+ if(HAVE_VISUAL_STUDIO_ARCH_AVX2)
78
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
79
+ endif(HAVE_VISUAL_STUDIO_ARCH_AVX2)
80
+ if(HAVE_CLANG_MAVX)
81
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
82
+ endif(HAVE_CLANG_MAVX)
83
+ if(HAVE_CLANG_MBMI2)
84
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mbmi2")
85
+ endif(HAVE_CLANG_MBMI2)
86
+ elseif (SNAPPY_REQUIRE_AVX)
87
+ if(HAVE_VISUAL_STUDIO_ARCH_AVX)
88
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX")
89
+ endif(HAVE_VISUAL_STUDIO_ARCH_AVX)
90
+ if(HAVE_CLANG_MAVX)
91
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
92
+ endif(HAVE_CLANG_MAVX)
93
+ endif(SNAPPY_REQUIRE_AVX2)
94
+
95
+ include(CheckCXXSourceCompiles)
96
+ check_cxx_source_compiles("
97
+ int main() {
98
+ return __builtin_expect(0, 1);
99
+ }" HAVE_BUILTIN_EXPECT)
100
+
101
+ check_cxx_source_compiles("
102
+ int main() {
103
+ return __builtin_ctzll(0);
104
+ }" HAVE_BUILTIN_CTZ)
105
+
106
+ check_cxx_source_compiles("
107
+ #include <tmmintrin.h>
108
+
109
+ int main() {
110
+ const __m128i *src = 0;
111
+ __m128i dest;
112
+ const __m128i shuffle_mask = _mm_load_si128(src);
113
+ const __m128i pattern = _mm_shuffle_epi8(_mm_loadl_epi64(src), shuffle_mask);
114
+ _mm_storeu_si128(&dest, pattern);
115
+ return 0;
116
+ }" SNAPPY_HAVE_SSSE3)
117
+
118
+ check_cxx_source_compiles("
119
+ #include <immintrin.h>
120
+ int main() {
121
+ return _bzhi_u32(0, 1);
122
+ }" SNAPPY_HAVE_BMI2)
123
+
124
+ include(CheckSymbolExists)
125
+ check_symbol_exists("mmap" "sys/mman.h" HAVE_FUNC_MMAP)
126
+ check_symbol_exists("sysconf" "unistd.h" HAVE_FUNC_SYSCONF)
127
+
128
+ find_package(GTest QUIET)
129
+ if(GTEST_FOUND)
130
+ set(HAVE_GTEST 1)
131
+ endif(GTEST_FOUND)
132
+
133
+ find_package(Gflags QUIET)
134
+ if(GFLAGS_FOUND)
135
+ set(HAVE_GFLAGS 1)
136
+ endif(GFLAGS_FOUND)
137
+
138
+ configure_file(
139
+ "cmake/config.h.in"
140
+ "${PROJECT_BINARY_DIR}/config.h"
141
+ )
142
+
143
+ # We don't want to define HAVE_ macros in public headers. Instead, we use
144
+ # CMake's variable substitution with 0/1 variables, which will be seen by the
145
+ # preprocessor as constants.
146
+ set(HAVE_SYS_UIO_H_01 ${HAVE_SYS_UIO_H})
147
+ if(NOT HAVE_SYS_UIO_H_01)
148
+ set(HAVE_SYS_UIO_H_01 0)
149
+ endif(NOT HAVE_SYS_UIO_H_01)
150
+
151
+ if (SNAPPY_FUZZING_BUILD)
152
+ if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
153
+ message(WARNING "Fuzzing builds are only supported with Clang")
154
+ endif (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
155
+
156
+ if(NOT CMAKE_CXX_FLAGS MATCHES "-fsanitize=address")
157
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
158
+ endif(NOT CMAKE_CXX_FLAGS MATCHES "-fsanitize=address")
159
+
160
+ if(NOT CMAKE_CXX_FLAGS MATCHES "-fsanitize=fuzzer-no-link")
161
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer-no-link")
162
+ endif(NOT CMAKE_CXX_FLAGS MATCHES "-fsanitize=fuzzer-no-link")
163
+ endif (SNAPPY_FUZZING_BUILD)
164
+
165
+ configure_file(
166
+ "snappy-stubs-public.h.in"
167
+ "${PROJECT_BINARY_DIR}/snappy-stubs-public.h")
168
+
169
+ add_library(snappy "")
170
+ target_sources(snappy
171
+ PRIVATE
172
+ "snappy-internal.h"
173
+ "snappy-stubs-internal.h"
174
+ "snappy-c.cc"
175
+ "snappy-sinksource.cc"
176
+ "snappy-stubs-internal.cc"
177
+ "snappy.cc"
178
+ "${PROJECT_BINARY_DIR}/config.h"
179
+
180
+ # Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
181
+ $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
182
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
183
+ $<INSTALL_INTERFACE:include/snappy-c.h>
184
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
185
+ $<INSTALL_INTERFACE:include/snappy-sinksource.h>
186
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy.h>
187
+ $<INSTALL_INTERFACE:include/snappy.h>
188
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/snappy-stubs-public.h>
189
+ $<INSTALL_INTERFACE:include/snappy-stubs-public.h>
190
+ )
191
+ target_include_directories(snappy
192
+ PUBLIC
193
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
194
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
195
+ $<INSTALL_INTERFACE:include>
196
+ )
197
+ set_target_properties(snappy
198
+ PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
199
+
200
+ target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
201
+ if(BUILD_SHARED_LIBS)
202
+ set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
203
+ endif(BUILD_SHARED_LIBS)
204
+
205
+ if(SNAPPY_BUILD_TESTS)
206
+ enable_testing()
207
+
208
+ add_executable(snappy_unittest "")
209
+ target_sources(snappy_unittest
210
+ PRIVATE
211
+ "snappy_unittest.cc"
212
+ "snappy-test.cc"
213
+ )
214
+ target_compile_definitions(snappy_unittest PRIVATE -DHAVE_CONFIG_H)
215
+ target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES})
216
+
217
+ if(HAVE_LIBZ)
218
+ target_link_libraries(snappy_unittest z)
219
+ endif(HAVE_LIBZ)
220
+ if(HAVE_LIBLZO2)
221
+ target_link_libraries(snappy_unittest lzo2)
222
+ endif(HAVE_LIBLZO2)
223
+
224
+ target_include_directories(snappy_unittest
225
+ BEFORE PRIVATE
226
+ "${PROJECT_SOURCE_DIR}"
227
+ "${GTEST_INCLUDE_DIRS}"
228
+ "${GFLAGS_INCLUDE_DIRS}"
229
+ )
230
+
231
+ add_test(
232
+ NAME snappy_unittest
233
+ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
234
+ COMMAND "${PROJECT_BINARY_DIR}/snappy_unittest")
235
+ endif(SNAPPY_BUILD_TESTS)
236
+
237
+ if(SNAPPY_FUZZING_BUILD)
238
+ add_executable(snappy_compress_fuzzer "")
239
+ target_sources(snappy_compress_fuzzer
240
+ PRIVATE "snappy_compress_fuzzer.cc"
241
+ )
242
+ target_link_libraries(snappy_compress_fuzzer snappy)
243
+ set_target_properties(snappy_compress_fuzzer
244
+ PROPERTIES LINK_FLAGS "-fsanitize=fuzzer"
245
+ )
246
+
247
+ add_executable(snappy_uncompress_fuzzer "")
248
+ target_sources(snappy_uncompress_fuzzer
249
+ PRIVATE "snappy_uncompress_fuzzer.cc"
250
+ )
251
+ target_link_libraries(snappy_uncompress_fuzzer snappy)
252
+ set_target_properties(snappy_uncompress_fuzzer
253
+ PROPERTIES LINK_FLAGS "-fsanitize=fuzzer"
254
+ )
255
+ endif(SNAPPY_FUZZING_BUILD)
256
+
257
+ # Must be included before CMAKE_INSTALL_INCLUDEDIR is used.
258
+ include(GNUInstallDirs)
259
+
260
+ if(SNAPPY_INSTALL)
261
+ install(TARGETS snappy
262
+ EXPORT SnappyTargets
263
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
264
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
265
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
266
+ )
267
+ install(
268
+ FILES
269
+ "snappy-c.h"
270
+ "snappy-sinksource.h"
271
+ "snappy.h"
272
+ "${PROJECT_BINARY_DIR}/snappy-stubs-public.h"
273
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
274
+ )
275
+
276
+ include(CMakePackageConfigHelpers)
277
+ configure_package_config_file(
278
+ "cmake/${PROJECT_NAME}Config.cmake.in"
279
+ "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
280
+ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
281
+ )
282
+ write_basic_package_version_file(
283
+ "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
284
+ COMPATIBILITY SameMajorVersion
285
+ )
286
+ install(
287
+ EXPORT SnappyTargets
288
+ NAMESPACE Snappy::
289
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
290
+ )
291
+ install(
292
+ FILES
293
+ "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
294
+ "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
295
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
296
+ )
297
+ endif(SNAPPY_INSTALL)
@@ -0,0 +1,26 @@
1
+ # How to Contribute
2
+
3
+ We'd love to accept your patches and contributions to this project. There are
4
+ just a few small guidelines you need to follow.
5
+
6
+ ## Contributor License Agreement
7
+
8
+ Contributions to this project must be accompanied by a Contributor License
9
+ Agreement. You (or your employer) retain the copyright to your contribution,
10
+ this simply gives us permission to use and redistribute your contributions as
11
+ part of the project. Head over to <https://cla.developers.google.com/> to see
12
+ your current agreements on file or to sign a new one.
13
+
14
+ You generally only need to submit a CLA once, so if you've already submitted one
15
+ (even if it was for a different project), you probably don't need to do it
16
+ again.
17
+
18
+ ## Code reviews
19
+
20
+ All submissions, including submissions by project members, require review. We
21
+ use GitHub pull requests for this purpose. Consult
22
+ [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23
+ information on using pull requests.
24
+
25
+ Please make sure that all the automated checks (CLA, AppVeyor, Travis) pass for
26
+ your pull requests. Pull requests whose checks fail may be ignored.
data/vendor/snappy/NEWS CHANGED
@@ -1,3 +1,43 @@
1
+ Snappy v1.1.8, January 15th 2020:
2
+
3
+ * Small performance improvements.
4
+
5
+ * Removed snappy::string alias for std::string.
6
+
7
+ * Improved CMake configuration.
8
+
9
+ Snappy v1.1.7, August 24th 2017:
10
+
11
+ * Improved CMake build support for 64-bit Linux distributions.
12
+
13
+ * MSVC builds now use MSVC-specific intrinsics that map to clzll.
14
+
15
+ * ARM64 (AArch64) builds use the code paths optimized for 64-bit processors.
16
+
17
+ Snappy v1.1.6, July 12th 2017:
18
+
19
+ This is a re-release of v1.1.5 with proper SONAME / SOVERSION values.
20
+
21
+ Snappy v1.1.5, June 28th 2017:
22
+
23
+ This release has broken SONAME / SOVERSION values. Users of snappy as a shared
24
+ library should avoid 1.1.5 and use 1.1.6 instead. SONAME / SOVERSION errors will
25
+ manifest as the dynamic library loader complaining that it cannot find snappy's
26
+ shared library file (libsnappy.so / libsnappy.dylib), or that the library it
27
+ found does not have the required version. 1.1.6 has the same code as 1.1.5, but
28
+ carries build configuration fixes for the issues above.
29
+
30
+ * Add CMake build support. The autoconf build support is now deprecated, and
31
+ will be removed in the next release.
32
+
33
+ * Add AppVeyor configuration, for Windows CI coverage.
34
+
35
+ * Small performance improvement on little-endian PowerPC.
36
+
37
+ * Small performance improvement on LLVM with position-independent executables.
38
+
39
+ * Fix a few issues with various build environments.
40
+
1
41
  Snappy v1.1.4, January 25th 2017:
2
42
 
3
43
  * Fix a 1% performance regression when snappy is used in PIE executables.
@@ -34,7 +34,7 @@ Snappy is intended to be fast. On a single core of a Core i7 processor
34
34
  in 64-bit mode, it compresses at about 250 MB/sec or more and decompresses at
35
35
  about 500 MB/sec or more. (These numbers are for the slowest inputs in our
36
36
  benchmark suite; others are much faster.) In our tests, Snappy usually
37
- is faster than algorithms in the same class (e.g. LZO, LZF, FastLZ, QuickLZ,
37
+ is faster than algorithms in the same class (e.g. LZO, LZF, QuickLZ,
38
38
  etc.) while achieving comparable compression ratios.
39
39
 
40
40
  Typical compression ratios (based on the benchmark suite) are about 1.5-1.7x
@@ -51,8 +51,8 @@ In particular:
51
51
 
52
52
  - Snappy uses 64-bit operations in several places to process more data at
53
53
  once than would otherwise be possible.
54
- - Snappy assumes unaligned 32- and 64-bit loads and stores are cheap.
55
- On some platforms, these must be emulated with single-byte loads
54
+ - Snappy assumes unaligned 32 and 64-bit loads and stores are cheap.
55
+ On some platforms, these must be emulated with single-byte loads
56
56
  and stores, which is much slower.
57
57
  - Snappy assumes little-endian throughout, and needs to byte-swap data in
58
58
  several places if running on a big-endian platform.
@@ -62,25 +62,40 @@ Performance optimizations, whether for 64-bit x86 or other platforms,
62
62
  are of course most welcome; see "Contact", below.
63
63
 
64
64
 
65
+ Building
66
+ ========
67
+
68
+ You need the CMake version specified in [CMakeLists.txt](./CMakeLists.txt)
69
+ or later to build:
70
+
71
+ ```bash
72
+ mkdir build
73
+ cd build && cmake ../ && make
74
+ ```
75
+
65
76
  Usage
66
77
  =====
67
78
 
68
79
  Note that Snappy, both the implementation and the main interface,
69
80
  is written in C++. However, several third-party bindings to other languages
70
- are available; see the home page at http://google.github.io/snappy/
71
- for more information. Also, if you want to use Snappy from C code, you can
72
- use the included C bindings in snappy-c.h.
81
+ are available; see the [home page](docs/README.md) for more information.
82
+ Also, if you want to use Snappy from C code, you can use the included C
83
+ bindings in snappy-c.h.
73
84
 
74
85
  To use Snappy from your own C++ program, include the file "snappy.h" from
75
86
  your calling file, and link against the compiled library.
76
87
 
77
88
  There are many ways to call Snappy, but the simplest possible is
78
89
 
79
- snappy::Compress(input.data(), input.size(), &output);
90
+ ```c++
91
+ snappy::Compress(input.data(), input.size(), &output);
92
+ ```
80
93
 
81
94
  and similarly
82
95
 
83
- snappy::Uncompress(input.data(), input.size(), &output);
96
+ ```c++
97
+ snappy::Uncompress(input.data(), input.size(), &output);
98
+ ```
84
99
 
85
100
  where "input" and "output" are both instances of std::string.
86
101
 
@@ -102,12 +117,12 @@ tests to verify you have not broken anything. Note that if you have the
102
117
  Google Test library installed, unit test behavior (especially failures) will be
103
118
  significantly more user-friendly. You can find Google Test at
104
119
 
105
- http://github.com/google/googletest
120
+ https://github.com/google/googletest
106
121
 
107
122
  You probably also want the gflags library for handling of command-line flags;
108
123
  you can find it at
109
124
 
110
- http://gflags.github.io/gflags/
125
+ https://gflags.github.io/gflags/
111
126
 
112
127
  In addition to the unit tests, snappy contains microbenchmarks used to
113
128
  tune compression and decompression performance. These are automatically run
@@ -116,7 +131,7 @@ before the unit tests, but you can disable them using the flag
116
131
  need to edit the source).
117
132
 
118
133
  Finally, snappy can benchmark Snappy against a few other compression libraries
119
- (zlib, LZO, LZF, FastLZ and QuickLZ), if they were detected at configure time.
134
+ (zlib, LZO, LZF, and QuickLZ), if they were detected at configure time.
120
135
  To benchmark using a given file, give the compression algorithm you want to test
121
136
  Snappy against (e.g. --zlib) and then a list of one or more file names on the
122
137
  command line. The testdata/ directory contains the files used by the
@@ -130,10 +145,4 @@ Contact
130
145
  =======
131
146
 
132
147
  Snappy is distributed through GitHub. For the latest version, a bug tracker,
133
- and other information, see
134
-
135
- http://google.github.io/snappy/
136
-
137
- or the repository at
138
-
139
- https://github.com/google/snappy
148
+ and other information, see https://github.com/google/snappy.
@@ -0,0 +1,33 @@
1
+ # Copyright 2019 Google Inc. All Rights Reserved.
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are
5
+ # met:
6
+ #
7
+ # * Redistributions of source code must retain the above copyright
8
+ # notice, this list of conditions and the following disclaimer.
9
+ # * Redistributions in binary form must reproduce the above
10
+ # copyright notice, this list of conditions and the following disclaimer
11
+ # in the documentation and/or other materials provided with the
12
+ # distribution.
13
+ # * Neither the name of Google Inc. nor the names of its
14
+ # contributors may be used to endorse or promote products derived from
15
+ # this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ @PACKAGE_INIT@
30
+
31
+ include("${CMAKE_CURRENT_LIST_DIR}/SnappyTargets.cmake")
32
+
33
+ check_required_components(Snappy)
@@ -0,0 +1,62 @@
1
+ #ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
2
+ #define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
3
+
4
+ /* Define to 1 if the compiler supports __builtin_ctz and friends. */
5
+ #cmakedefine HAVE_BUILTIN_CTZ 1
6
+
7
+ /* Define to 1 if the compiler supports __builtin_expect. */
8
+ #cmakedefine HAVE_BUILTIN_EXPECT 1
9
+
10
+ /* Define to 1 if you have the <byteswap.h> header file. */
11
+ #cmakedefine HAVE_BYTESWAP_H 1
12
+
13
+ /* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */
14
+ #cmakedefine HAVE_FUNC_MMAP 1
15
+
16
+ /* Define to 1 if you have a definition for sysconf() in <unistd.h>. */
17
+ #cmakedefine HAVE_FUNC_SYSCONF 1
18
+
19
+ /* Define to 1 to use the gflags package for command-line parsing. */
20
+ #cmakedefine HAVE_GFLAGS 1
21
+
22
+ /* Define to 1 if you have Google Test. */
23
+ #cmakedefine HAVE_GTEST 1
24
+
25
+ /* Define to 1 if you have the `lzo2' library (-llzo2). */
26
+ #cmakedefine HAVE_LIBLZO2 1
27
+
28
+ /* Define to 1 if you have the `z' library (-lz). */
29
+ #cmakedefine HAVE_LIBZ 1
30
+
31
+ /* Define to 1 if you have the <sys/endian.h> header file. */
32
+ #cmakedefine HAVE_SYS_ENDIAN_H 1
33
+
34
+ /* Define to 1 if you have the <sys/mman.h> header file. */
35
+ #cmakedefine HAVE_SYS_MMAN_H 1
36
+
37
+ /* Define to 1 if you have the <sys/resource.h> header file. */
38
+ #cmakedefine HAVE_SYS_RESOURCE_H 1
39
+
40
+ /* Define to 1 if you have the <sys/time.h> header file. */
41
+ #cmakedefine HAVE_SYS_TIME_H 1
42
+
43
+ /* Define to 1 if you have the <sys/uio.h> header file. */
44
+ #cmakedefine HAVE_SYS_UIO_H 1
45
+
46
+ /* Define to 1 if you have the <unistd.h> header file. */
47
+ #cmakedefine HAVE_UNISTD_H 1
48
+
49
+ /* Define to 1 if you have the <windows.h> header file. */
50
+ #cmakedefine HAVE_WINDOWS_H 1
51
+
52
+ /* Define to 1 if you target processors with SSSE3+ and have <tmmintrin.h>. */
53
+ #cmakedefine01 SNAPPY_HAVE_SSSE3
54
+
55
+ /* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */
56
+ #cmakedefine01 SNAPPY_HAVE_BMI2
57
+
58
+ /* Define to 1 if your processor stores words with the most significant byte
59
+ first (like Motorola and SPARC, unlike Intel and VAX). */
60
+ #cmakedefine SNAPPY_IS_BIG_ENDIAN 1
61
+
62
+ #endif // THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
@@ -0,0 +1,72 @@
1
+ Snappy is a compression/decompression library. It does not aim for maximum
2
+ compression, or compatibility with any other compression library; instead, it
3
+ aims for very high speeds and reasonable compression. For instance, compared
4
+ to the fastest mode of zlib, Snappy is an order of magnitude faster for most
5
+ inputs, but the resulting compressed files are anywhere from 20% to 100%
6
+ bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy
7
+ compresses at about 250 MB/sec or more and decompresses at about 500 MB/sec
8
+ or more.
9
+
10
+ Snappy is widely used inside Google, in everything from BigTable and MapReduce
11
+ to our internal RPC systems. (Snappy has previously been referred to as "Zippy"
12
+ in some presentations and the likes.)
13
+
14
+ For more information, please see the [README](../README.md). Benchmarks against
15
+ a few other compression libraries (zlib, LZO, LZF, FastLZ, and QuickLZ) are
16
+ included in the source code distribution. The source code also contains a
17
+ [formal format specification](../format_description.txt), as well
18
+ as a specification for a [framing format](../framing_format.txt) useful for
19
+ higher-level framing and encapsulation of Snappy data, e.g. for transporting
20
+ Snappy-compressed data across HTTP in a streaming fashion. Note that the Snappy
21
+ distribution currently has no code implementing the latter, but some of the
22
+ ports do (see below).
23
+
24
+ Snappy is written in C++, but C bindings are included, and several bindings to
25
+ other languages are maintained by third parties:
26
+
27
+ * C#: [Snappy for .NET](http://snappy4net.codeplex.com/) (P/Invoke wrapper),
28
+ [Snappy.NET](http://snappy.angeloflogic.com/) (P/Invoke wrapper),
29
+ [Snappy.Sharp](https://github.com/jeffesp/Snappy.Sharp) (native
30
+ reimplementation)
31
+ * [C port](http://github.com/andikleen/snappy-c)
32
+ * [C++ MSVC packaging](http://snappy.angeloflogic.com/) (plus Windows binaries,
33
+ NuGet packages and command-line tool)
34
+ * Common Lisp: [Library bindings](http://flambard.github.com/thnappy/),
35
+ [native reimplementation](https://github.com/brown/snappy)
36
+ * Erlang: [esnappy](https://github.com/thekvs/esnappy),
37
+ [snappy-erlang-nif](https://github.com/fdmanana/snappy-erlang-nif)
38
+ * [Go](https://github.com/golang/snappy/)
39
+ * [Haskell](http://hackage.haskell.org/package/snappy)
40
+ * [Haxe](https://github.com/MaddinXx/hxsnappy) (C++/Neko)
41
+ * [iOS packaging](https://github.com/ideawu/snappy-ios)
42
+ * Java: [JNI wrapper](https://github.com/xerial/snappy-java) (including the
43
+ framing format), [native reimplementation](http://code.google.com/p/jsnappy/),
44
+ [other native reimplementation](https://github.com/dain/snappy) (including
45
+ the framing format)
46
+ * [Lua](https://github.com/forhappy/lua-snappy)
47
+ * [Node.js](https://github.com/kesla/node-snappy) (including the [framing
48
+ format](https://github.com/kesla/node-snappy-stream))
49
+ * [Perl](http://search.cpan.org/dist/Compress-Snappy/)
50
+ * [PHP](https://github.com/kjdev/php-ext-snappy)
51
+ * [Python](http://pypi.python.org/pypi/python-snappy) (including a command-line
52
+ tool for the framing format)
53
+ * [R](https://github.com/lulyon/R-snappy)
54
+ * [Ruby](https://github.com/miyucy/snappy)
55
+ * [Rust](https://github.com/BurntSushi/rust-snappy)
56
+ * [Smalltalk](https://github.com/mumez/sqnappy) (including the framing format)
57
+
58
+ Snappy is used or is available as an alternative in software such as
59
+
60
+ * [MongoDB](https://www.mongodb.com/)
61
+ * [Cassandra](http://cassandra.apache.org/)
62
+ * [Couchbase](http://www.couchbase.com/)
63
+ * [Hadoop](http://hadoop.apache.org/)
64
+ * [LessFS](http://www.lessfs.com/wordpress/)
65
+ * [LevelDB](https://github.com/google/leveldb) (which is in turn used by
66
+ [Google Chrome](http://chrome.google.com/))
67
+ * [Lucene](http://lucene.apache.org/)
68
+ * [VoltDB](http://voltdb.com/)
69
+
70
+ If you know of more, do not hesitate to let us know. The easiest way to get in
71
+ touch is via the
72
+ [Snappy discussion mailing list](http://groups.google.com/group/snappy-compression).