You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2025/06/13 17:45:01 UTC
(couchdb-snappy) branch update-readme created (now 257a95b)
This is an automated email from the ASF dual-hosted git repository.
jiahuili430 pushed a change to branch update-readme
in repository https://gitbox.apache.org/repos/asf/couchdb-snappy.git
at 257a95b Updated example snippet in README.md
This branch includes the following new commits:
new 257a95b Updated example snippet in README.md
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(couchdb-snappy) 01/01: Updated example snippet in README.md
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jiahuili430 pushed a commit to branch update-readme
in repository https://gitbox.apache.org/repos/asf/couchdb-snappy.git
commit 257a95b51e044210d7444c4d0bc426eec034ff50
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Fri Jun 13 12:44:08 2025 -0500
Updated example snippet in README.md
---
Makefile | 1 +
README.md | 210 ++++++++++++++++++++++++++++++--------------------------------
2 files changed, 103 insertions(+), 108 deletions(-)
diff --git a/Makefile b/Makefile
index 058a7ec..da50d89 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+# Get rebar from https://github.com/apache/couchdb-rebar
REBAR?=rebar
diff --git a/README.md b/README.md
index 0e54b59..a1709c7 100644
--- a/README.md
+++ b/README.md
@@ -8,121 +8,115 @@ Google snappy's official repository and bug tracking system is at:
Its source is included in this project.
-
# site
https://github.com/fdmanana/snappy-erlang-nif
-
# performance tests
-Snappy is much faster than zlib's deflate compression, specially for reasonably large amounts of
-data. Here follow a few basic tests.
+Snappy is much faster than zlib's deflate compression, specially for reasonably
+large amounts of data. Here follow a few basic tests.
-<pre>
-Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
+```bash
+erl
+Erlang/OTP 26 [erts-14.2.5.10] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1]
-Eshell V5.8.3 (abort with ^G)
-1> code:add_path("ebin").
+Eshell V14.2.5.10 (press Ctrl+G to abort, type help(). for help)
+1> code:add_path("ebin").
true
-2> {ok, J} = file:read_file("../seatoncouch/doc_11k.json").
-{ok,<<"{\n\"data3\":\"ColreUHAtn8iYvHIHw2ohiAuaXNGNX9WhlwANGDBYKYs6YEvHXgFXRkWuYoFyfLVqtjZNPedtukWRDXFz7VUOl4APLS7GB9Nw"...>>}
-3>
-3> timer:tc(snappy, compress, [J]).
-{4365,
- {ok,<<"úZðÔ{\n\"data3\":\"ColreUHAtn8iYvHIHw2ohiAuaXNGNX9WhlwANGDBYKYs6YEvHXgFXRkWuYoFyfLVqtjZNPedtukWRDXFz7VUO"...>>}}
-4> timer:tc(snappy, compress, [J]).
-{115,
- {ok,<<"úZðÔ{\n\"data3\":\"ColreUHAtn8iYvHIHw2ohiAuaXNGNX9WhlwANGDBYKYs6YEvHXgFXRkWuYoFyfLVqtjZNPedtukWRDXFz7VUO"...>>}}
-5> timer:tc(snappy, compress, [J]).
-{113,
- {ok,<<"úZðÔ{\n\"data3\":\"ColreUHAtn8iYvHIHw2ohiAuaXNGNX9WhlwANGDBYKYs6YEvHXgFXRkWuYoFyfLVqtjZNPedtukWRDXFz7VUO"...>>}}
-6> timer:tc(snappy, compress, [J]).
-{112,
- {ok,<<"úZðÔ{\n\"data3\":\"ColreUHAtn8iYvHIHw2ohiAuaXNGNX9WhlwANGDBYKYs6YEvHXgFXRkWuYoFyfLVqtjZNPedtukWRDXFz7VUO"...>>}}
-7> timer:tc(snappy, compress, [J]).
-{113,
- {ok,<<"úZðÔ{\n\"data3\":\"ColreUHAtn8iYvHIHw2ohiAuaXNGNX9WhlwANGDBYKYs6YEvHXgFXRkWuYoFyfLVqtjZNPedtukWRDXFz7VUO"...>>}}
-8> timer:tc(snappy, compress, [J]).
-{111,
- {ok,<<"úZðÔ{\n\"data3\":\"ColreUHAtn8iYvHIHw2ohiAuaXNGNX9WhlwANGDBYKYs6YEvHXgFXRkWuYoFyfLVqtjZNPedtukWRDXFz7VUO"...>>}}
-9>
-9> timer:tc(zlib, zip, [J]).
-{1025,
- <<237,88,217,142,226,88,18,125,175,175,104,241,108,89,
- 119,95,234,13,39,24,179,153,37,49,182,25,181,...>>}
-10> timer:tc(zlib, zip, [J]).
-{753,
- <<237,88,217,142,226,88,18,125,175,175,104,241,108,89,
- 119,95,234,13,39,24,179,153,37,49,182,25,181,...>>}
-11> timer:tc(zlib, zip, [J]).
-{974,
- <<237,88,217,142,226,88,18,125,175,175,104,241,108,89,
- 119,95,234,13,39,24,179,153,37,49,182,25,181,...>>}
-12> timer:tc(zlib, zip, [J]).
-{753,
- <<237,88,217,142,226,88,18,125,175,175,104,241,108,89,
- 119,95,234,13,39,24,179,153,37,49,182,25,181,...>>}
-13> timer:tc(zlib, zip, [J]).
-{960,
- <<237,88,217,142,226,88,18,125,175,175,104,241,108,89,
- 119,95,234,13,39,24,179,153,37,49,182,25,181,...>>}
-14> timer:tc(zlib, zip, [J]).
-{769,
- <<237,88,217,142,226,88,18,125,175,175,104,241,108,89,
- 119,95,234,13,39,24,179,153,37,49,182,25,181,...>>}
-15>
-15> byte_size(element(2, snappy:compress(J))).
-2846
-16> byte_size(zlib:zip(J)).
-1858
-17>
-17> crypto:start().
+2> {ok, J} = file:read_file("doc_11k.json").
+{ok,<<"{\n \"data3\": \"vh3w3TyPAxe01SOJhOgTMzOI8vO6tUZv0h36XVdRvECcDBJW5VAeLOJC1u9NRumMg5BcDp932M41Plr1Rg0sekoUawsGZL"...>>}
+3> timer:tc(snappy, compress, [J]).
+{251616,
+ {ok,<<"øUô÷*{\n \"data3\": \"vh3w3TyPAxe01SOJhOgTMzOI8vO6tUZv0h36XVdRvECcDBJW5VAeLOJC1u9NRumMg5BcDp932M41Plr1R"...>>}}
+4> timer:tc(snappy, compress, [J]).
+{59,
+ {ok,<<"øUô÷*{\n \"data3\": \"vh3w3TyPAxe01SOJhOgTMzOI8vO6tUZv0h36XVdRvECcDBJW5VAeLOJC1u9NRumMg5BcDp932M41Plr1R"...>>}}
+5> timer:tc(snappy, compress, [J]).
+{36,
+ {ok,<<"øUô÷*{\n \"data3\": \"vh3w3TyPAxe01SOJhOgTMzOI8vO6tUZv0h36XVdRvECcDBJW5VAeLOJC1u9NRumMg5BcDp932M41Plr1R"...>>}}
+6> timer:tc(snappy, compress, [J]).
+{57,
+ {ok,<<"øUô÷*{\n \"data3\": \"vh3w3TyPAxe01SOJhOgTMzOI8vO6tUZv0h36XVdRvECcDBJW5VAeLOJC1u9NRumMg5BcDp932M41Plr1R"...>>}}
+7> timer:tc(snappy, compress, [J]).
+{34,
+ {ok,<<"øUô÷*{\n \"data3\": \"vh3w3TyPAxe01SOJhOgTMzOI8vO6tUZv0h36XVdRvECcDBJW5VAeLOJC1u9NRumMg5BcDp932M41Plr1R"...>>}}
+8> timer:tc(snappy, compress, [J]).
+{53,
+ {ok,<<"øUô÷*{\n \"data3\": \"vh3w3TyPAxe01SOJhOgTMzOI8vO6tUZv0h36XVdRvECcDBJW5VAeLOJC1u9NRumMg5BcDp932M41Plr1R"...>>}}
+9>
+ timer:tc(zlib, zip, [J]).
+{461,
+ <<21,154,71,14,165,74,18,69,231,127,21,95,181,2,188,233,
+ 25,222,123,207,12,239,125,98,91,189,247,...>>}
+10> timer:tc(zlib, zip, [J]).
+{431,
+ <<21,154,71,14,165,74,18,69,231,127,21,95,181,2,188,233,
+ 25,222,123,207,12,239,125,98,91,189,247,...>>}
+11> timer:tc(zlib, zip, [J]).
+{440,
+ <<21,154,71,14,165,74,18,69,231,127,21,95,181,2,188,233,
+ 25,222,123,207,12,239,125,98,91,189,247,...>>}
+12> timer:tc(zlib, zip, [J]).
+{332,
+ <<21,154,71,14,165,74,18,69,231,127,21,95,181,2,188,233,
+ 25,222,123,207,12,239,125,98,91,189,247,...>>}
+13> timer:tc(zlib, zip, [J]).
+{303,
+ <<21,154,71,14,165,74,18,69,231,127,21,95,181,2,188,233,
+ 25,222,123,207,12,239,125,98,91,189,247,...>>}
+14> timer:tc(zlib, zip, [J]).
+{406,
+ <<21,154,71,14,165,74,18,69,231,127,21,95,181,2,188,233,
+ 25,222,123,207,12,239,125,98,91,189,247,...>>}
+15>
+ byte_size(element(2, snappy:compress(J))).
+11005
+16> byte_size(zlib:zip(J)).
+8284
+17>
+ crypto:start().
ok
-18> Large = base64:encode(crypto:rand_bytes(100 * 1024)).
-<<"72GMvPLuWJLJeYSlNm9oNkYkbjTeSBDgTrqamQ/zgj7hcUge1co6LvldJyitKPZkMPQGnrN98EyqSyWto3k7ShNgiNc05Gt4zdXSbTVSDzeID661DnJX"...>>
-19>
-19> timer:tc(snappy, compress, [Large]).
-{365,
- {ok,<<216,170,8,244,255,127,55,50,71,77,118,80,76,117,
- 87,74,76,74,101,89,83,108,78,109,57,...>>}}
-20> timer:tc(snappy, compress, [Large]).
-{541,
- {ok,<<216,170,8,244,255,127,55,50,71,77,118,80,76,117,
- 87,74,76,74,101,89,83,108,78,109,57,...>>}}
-21> timer:tc(snappy, compress, [Large]).
-{455,
- {ok,<<216,170,8,244,255,127,55,50,71,77,118,80,76,117,
- 87,74,76,74,101,89,83,108,78,109,57,...>>}}
-22> timer:tc(snappy, compress, [Large]).
-{479,
- {ok,<<216,170,8,244,255,127,55,50,71,77,118,80,76,117,
- 87,74,76,74,101,89,83,108,78,109,57,...>>}}
-23>
-23> timer:tc(zlib, zip, [Large]).
-{14666,
- <<20,155,181,118,195,64,20,5,63,72,133,152,74,49,147,197,
- 234,196,204,236,175,143,115,210,164,112,188,...>>}
-24> timer:tc(zlib, zip, [Large]).
-{19716,
- <<20,155,181,118,195,64,20,5,63,72,133,152,74,49,147,197,
- 234,196,204,236,175,143,115,210,164,112,188,...>>}
-25> timer:tc(zlib, zip, [Large]).
-{14561,
- <<20,155,181,118,195,64,20,5,63,72,133,152,74,49,147,197,
- 234,196,204,236,175,143,115,210,164,112,188,...>>}
-26> timer:tc(zlib, zip, [Large]).
-{21683,
- <<20,155,181,118,195,64,20,5,63,72,133,152,74,49,147,197,
- 234,196,204,236,175,143,115,210,164,112,188,...>>}
-27> timer:tc(zlib, zip, [Large]).
-{11575,
- <<20,155,181,118,195,64,20,5,63,72,133,152,74,49,147,197,
- 234,196,204,236,175,143,115,210,164,112,188,...>>}
-28>
-28> byte_size(element(2, snappy:compress(Large))).
-136554
-29> byte_size(zlib:zip(Large)).
-103440
-30>
-</pre>
+18> Large = base64:encode(crypto:strong_rand_bytes(100 * 1024)).
+<<"E8CcPijHF6N2/WMTvRkLr7FdkCWlndHx8iVh3n7ZPHD3khPnzPefazjDk7Ox2B1zIxA2TVB+4RDBSk2DmDXQM4sasup06Y2uZrsWgnUF9DBTkJVxuB3L"...>>
+19>
+ timer:tc(snappy, compress, [Large]).
+{201,
+ {ok,<<"ت\bôÿÿE8CcPijHF6N2/WMTvRkLr7FdkCWlndHx8iVh3n7ZPHD3khPnzPefazjDk7Ox2B1zIxA2TVB+4RDBSk2DmDXQM4sasup06Y"...>>}}
+20> timer:tc(snappy, compress, [Large]).
+{204,
+ {ok,<<"ت\bôÿÿE8CcPijHF6N2/WMTvRkLr7FdkCWlndHx8iVh3n7ZPHD3khPnzPefazjDk7Ox2B1zIxA2TVB+4RDBSk2DmDXQM4sasup06Y"...>>}}
+21> timer:tc(snappy, compress, [Large]).
+{179,
+ {ok,<<"ت\bôÿÿE8CcPijHF6N2/WMTvRkLr7FdkCWlndHx8iVh3n7ZPHD3khPnzPefazjDk7Ox2B1zIxA2TVB+4RDBSk2DmDXQM4sasup06Y"...>>}}
+22> timer:tc(snappy, compress, [Large]).
+{312,
+ {ok,<<"ت\bôÿÿE8CcPijHF6N2/WMTvRkLr7FdkCWlndHx8iVh3n7ZPHD3khPnzPefazjDk7Ox2B1zIxA2TVB+4RDBSk2DmDXQM4sasup06Y"...>>}}
+23>
+ timer:tc(zlib, zip, [Large]).
+{7116,
+ <<20,155,197,114,227,64,20,69,63,72,11,49,45,197,44,89,
+ 12,59,49,51,235,235,39,179,74,57,113,...>>}
+24> timer:tc(zlib, zip, [Large]).
+{7254,
+ <<20,155,197,114,227,64,20,69,63,72,11,49,45,197,44,89,
+ 12,59,49,51,235,235,39,179,74,57,113,...>>}
+25> timer:tc(zlib, zip, [Large]).
+{7136,
+ <<20,155,197,114,227,64,20,69,63,72,11,49,45,197,44,89,
+ 12,59,49,51,235,235,39,179,74,57,113,...>>}
+26> timer:tc(zlib, zip, [Large]).
+{6760,
+ <<20,155,197,114,227,64,20,69,63,72,11,49,45,197,44,89,
+ 12,59,49,51,235,235,39,179,74,57,113,...>>}
+27> timer:tc(zlib, zip, [Large]).
+{7349,
+ <<20,155,197,114,227,64,20,69,63,72,11,49,45,197,44,89,
+ 12,59,49,51,235,235,39,179,74,57,113,...>>}
+28>
+ byte_size(element(2, snappy:compress(Large))).
+136548
+29> byte_size(zlib:zip(Large)).
+103438
+30>
+```