Skip to content

Commit c4537e6

Browse files
committed
[nop] Housekeeping
1 parent 7581ad2 commit c4537e6

File tree

3 files changed

+41
-20
lines changed

3 files changed

+41
-20
lines changed

README.md

+26-7
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,35 @@ See [here][GitHub releases] for earlier releases.
2222

2323
## Why Nippy?
2424

25-
- Small, simple **all-Clojure** library
25+
- Small, simple **pure-Clojure** library
2626
- **Terrific performance**: the [best](#performance) for Clojure that I'm aware of
2727
- Comprehensive support for [all standard data types](../../wiki/1-Getting-started#deserializing)
2828
- Easily extendable to [custom data types](../../wiki/1-Getting-started#custom-types)
29-
- **Robust test suite**, incl. full coverage for every supported type
30-
- Auto fallback to [Java Serializable](https://taoensso.github.io/nippy/taoensso.nippy.html#var-*freeze-serializable-allowlist*) when available
31-
- Auto fallback to Clojure Reader for all other types (including tagged literals)
32-
- Pluggable **compression** with built-in [LZ4](https://code.google.com/p/lz4/), [Zstandard](https://facebook.github.io/zstd/), etc.
33-
- Pluggable [encryption](../../wiki/1-Getting-started#encryption) with built-in AES128
29+
- **Robust test suite** incl. coverage of every supported type
30+
- **Mature** and widely used in production for 12+ years
31+
- Optional auto fallback to [Java Serializable](https://taoensso.github.io/nippy/taoensso.nippy.html#var-*freeze-serializable-allowlist*) for [safe](https://cljdoc.org/d/com.taoensso/nippy/CURRENT/api/taoensso.nippy#*freeze-serializable-allowlist*) types
32+
- Optional auto fallback to Clojure Reader (including tagged literals)
33+
- Optional smart **compression** with [LZ4](https://code.google.com/p/lz4/) or [Zstandard](https://facebook.github.io/zstd/)
34+
- Optional [encryption](../../wiki/1-Getting-started#encryption) with AES128
3435
- [Tools](https://taoensso.github.io/nippy/taoensso.nippy.tools.html) for easy + robust **integration into 3rd-party libraries**, etc.
3536
- Powerful [thaw transducer](https://taoensso.github.io/nippy/taoensso.nippy.html#var-*thaw-xform*) for flexible data inspection and transformation
3637

38+
## Quick example
39+
40+
Nippy's super easy to use:
41+
42+
```clojure
43+
(require '[taoensso.nippy :as nippy])
44+
45+
;; Freeze any Clojure value
46+
(nippy/freeze <my-value>) ; => Serialized byte[]
47+
48+
;; Thaw the byte[] to get back the original value:
49+
(nippy/thaw (nippy/freeze <my-value>)) ; => <my-value>
50+
```
51+
52+
See the [wiki](https://github.com/taoensso/nippy/wiki/1-Getting-started#deserializing) for more.
53+
3754
## Operational considerations
3855

3956
### Data longevity
@@ -69,10 +86,12 @@ So starting with Nippy v3.4, Nippy's release notes will **always clearly indicat
6986

7087
## Performance
7188

72-
Since its earliest versions, Nippy has consistently been the **fastest serialization library for Clojure** that I'm aware of. Latest [benchmark](../../blob/master/test/taoensso/nippy_benchmarks.clj) results:
89+
Since its earliest versions, Nippy has consistently been the **fastest serialization library for Clojure** that I'm aware of. Latest results:
7390

7491
![benchmarks-png](../../raw/master/benchmarks.png)
7592

93+
PRs welcome to include other alternatives in the [benchmark suite](../../blob/master/test/taoensso/nippy_benchmarks.clj)!
94+
7695
## Documentation
7796

7897
- [Wiki][GitHub wiki] (getting started, usage, etc.)

src/taoensso/nippy.clj

+8-6
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@
12591259
- Compression is often benefitial at little/no cost
12601260
- The performance difference between `freeze` and `fast-freeze` is
12611261
often negligible in practice."
1262-
[x]
1262+
^bytes [x]
12631263
(let [baos (ByteArrayOutputStream. 64)
12641264
dos (DataOutputStream. baos)]
12651265
(with-cache (-freeze-with-meta! x dos))
@@ -1268,11 +1268,13 @@
12681268
(defn freeze
12691269
"Serializes arg (any Clojure data type) to a byte array.
12701270
To freeze custom types, extend the Clojure reader or see `extend-freeze`."
1271-
([x] (freeze x nil))
1272-
([x {:as opts
1273-
:keys [compressor encryptor password serializable-allowlist incl-metadata?]
1274-
:or {compressor :auto
1275-
encryptor aes128-gcm-encryptor}}]
1271+
(^bytes [x] (freeze x nil))
1272+
(^bytes
1273+
[x
1274+
{:as opts
1275+
:keys [compressor encryptor password serializable-allowlist incl-metadata?]
1276+
:or {compressor :auto
1277+
encryptor aes128-gcm-encryptor}}]
12761278

12771279
(call-with-bindings :freeze opts
12781280
(fn []

src/taoensso/nippy/compression.clj

+7-7
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@
174174
(def lz4-compressor
175175
"Default `LZ4` compressor:
176176
- Compression ratio: `C` (0.58 on reference benchmark).
177-
- Compression speed: `A` (238 msecs on reference benchmark).
178-
- Decompression speed: `A+` (31 msecs on reference benchmark).
177+
- Compression speed: `A` (240 msecs on reference benchmark).
178+
- Decompression speed: `A+` (30 msecs on reference benchmark).
179179
180180
Good general-purpose compressor, favours speed.
181181
See `taoensso.nippy-benchmarks` for detailed comparative benchmarks."
@@ -184,8 +184,8 @@
184184
(def lzo-compressor
185185
"Default `LZO` compressor:
186186
- Compression ratio: `C` (0.58 on reference benchmark).
187-
- Compression speed: `A` (216 msecs on reference benchmark).
188-
- Decompression speed: `A` (43 msecs on reference benchmark).
187+
- Compression speed: `A` (220 msecs on reference benchmark).
188+
- Decompression speed: `A` (40 msecs on reference benchmark).
189189
190190
Good general-purpose compressor, favours speed.
191191
See `taoensso.nippy-benchmarks` for detailed comparative benchmarks."
@@ -195,7 +195,7 @@
195195
"Default `LZMA2` compressor:
196196
- Compression ratio: `A+` (0.4 on reference benchmark).
197197
- Compression speed: `E` (18.5 secs on reference benchmark).
198-
- Decompression speed: `D` (11.8 secs on reference benchmark).
198+
- Decompression speed: `D` (12 secs on reference benchmark).
199199
200200
Specialized compressor, strongly favours ratio.
201201
See `taoensso.nippy-benchmarks` for detailed comparative benchmarks."
@@ -204,8 +204,8 @@
204204
(enc/def* snappy-compressor
205205
"Default `Snappy` compressor:
206206
- Compression ratio: `C` (0.58 on reference benchmark).
207-
- Compression speed: `A+` (206 msecs on reference benchmark).
208-
- Decompression speed: `B` (134 msecs on reference benchmark).
207+
- Compression speed: `A+` (210 msecs on reference benchmark).
208+
- Decompression speed: `B` (130 msecs on reference benchmark).
209209
Good general-purpose compressor, favours speed.
210210
See `taoensso.nippy-benchmarks` for detailed comparative benchmarks."
211211
(SnappyCompressor. false))

0 commit comments

Comments
 (0)