ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Compress-LZF/README
(Generate patch)

Comparing Compress-LZF/README (file contents):
Revision 1.3 by root, Fri Nov 2 12:36:51 2007 UTC vs.
Revision 1.4 by root, Sun Aug 25 18:13:26 2013 UTC

27 I have no idea wether any patents in any countries apply to this 27 I have no idea wether any patents in any countries apply to this
28 algorithm, but at the moment it is believed that it is free from any 28 algorithm, but at the moment it is believed that it is free from any
29 patents. 29 patents.
30 30
31FUNCTIONS 31FUNCTIONS
32 $compressed = compress $uncompressed 32 $compressed = compress $uncompressed
33 $compressed = compress_best $uncompressed
33 Try to compress the given string as quickly and as much as possible. In 34 Try to compress the given string as quickly and as much as possible.
34 the worst case, the string can enlarge by 1 byte, but that should be the 35 In the worst case, the string can enlarge by 1 byte, but that should
35 absolute exception. You can expect a 45% compression ratio on large, 36 be the absolute exception. You can expect a 45% compression ratio on
36 binary strings. 37 large, binary strings.
37 38
38 $decompressed = decompress $compressed 39 The "compress_best" function uses a different algorithm that is
39 Uncompress the string (compressed by "compress") and return the original 40 slower but usually achieves better compression.
40 data. Decompression errors can result in either broken data (there is no
41 checksum kept) or a runtime error.
42 41
43 $serialized = sfreeze $value (simplified freeze) 42 $decompressed = decompress $compressed
44 Often there is the need to serialize data into a string. This function 43 Uncompress the string (compressed by "compress") and return the
45 does that, by using the Storable module. It does the following 44 original data. Decompression errors can result in either broken data
46 transforms: 45 (there is no checksum kept) or a runtime error.
47 46
48 undef (the perl undefined value) 47 $serialized = sfreeze $value (simplified freeze)
49 => a special cookie (undef'ness is being preserved) 48 $serialized = sfreeze_best $value
50 IV, NV, PV (i.e. a _plain_ perl scalar): 49 Often there is the need to serialize data into a string. This
51 => stays as is when it contains normal text/numbers 50 function does that, by using the Storable module. It does the
52 => gets serialized into a string 51 following transforms:
53 RV, undef, other funny objects (magical ones for example):
54 => data structure is freeze'd into a string.
55 52
56 That is, it tries to leave "normal", human-readable data untouched but 53 undef (the perl undefined value)
57 still serializes complex data structures into strings. The idea is to 54 => a special cookie (undef'ness is being preserved)
58 keep readability as high as possible, and in cases readability can't be 55 IV, NV, PV (i.e. a _plain_ perl scalar):
59 helped anyways, it tries to compress the string. 56 => stays as is when it contains normal text/numbers
57 => gets serialized into a string
58 RV, undef, other funny objects (magical ones for example):
59 => data structure is freeze'd into a string.
60 60
61 The "sfreeze" functions will enlarge the original data one byte at most 61 That is, it tries to leave "normal", human-readable data untouched
62 and will only load the Storable method when neccessary. 62 but still serializes complex data structures into strings. The idea
63 is to keep readability as high as possible, and in cases readability
64 can't be helped anyways, it tries to compress the string.
63 65
64 $serialized = sfreeze_c $value (sfreeze and compress) 66 The "sfreeze" functions will enlarge the original data one byte at
65 Similar to "sfreeze", but always tries to "c"ompress the resulting 67 most and will only load the Storable method when neccessary.
66 string. This still leaves most small objects (most numbers) untouched.
67 68
68 $serialized = sfreeze_cr $value (sfreeze and compress references) 69 The "sfreeze_best" function uses a different algorithm that is
69 Similar to "sfreeze", but tries to "c"ompress the resulting string 70 slower but usually achieves better compression.
70 unless it's a "simple" string. References for example are not "simple"
71 and as such are being compressed.
72 71
73 $original_data = sthaw $serialized 72 $serialized = sfreeze_c $value (sfreeze and compress)
74 Recreate the original object from it's serialized representation. This 73 $serialized = sfreeze_c_best $value
75 function automatically detects all the different sfreeze formats. 74 Similar to "sfreeze", but always tries to "c"ompress the resulting
75 string. This still leaves most small objects (most numbers)
76 untouched.
76 77
78 The "sfreeze_c" function uses a different algorithm that is slower
79 but usually achieves better compression.
80
81 $serialized = sfreeze_cr $value (sfreeze and compress references)
82 $serialized = sfreeze_cr_best $value
83 Similar to "sfreeze", but tries to "c"ompress the resulting string
84 unless it's a "simple" string. References for example are not
85 "simple" and as such are being compressed.
86
87 The "sfreeze_cr_best" function uses a different algorithm that is
88 slower but usually achieves better compression.
89
90 $original_data = sthaw $serialized
91 Recreate the original object from it's serialized representation.
92 This function automatically detects all the different sfreeze
93 formats.
94
77 Compress::LZF::set_serializer $package, $freeze, $thaw 95 Compress::LZF::set_serializer $package, $freeze, $thaw
78 Set the serialize module and functions to use. The default is 96 Set the serialize module and functions to use. The default is
79 "Storable", "Storable::net_mstore" and "Storable::mretrieve", which 97 "Storable", "Storable::net_mstore" and "Storable::mretrieve", which
80 should be fine for most purposes. 98 should be fine for most purposes.
81 99
82SEE ALSO 100SEE ALSO
83 Other Compress::* modules, especially Compress::LZV1 (an older, less 101 Other Compress::* modules, especially Compress::LZV1 (an older, less
84 speedy module that guarentees only 1 byte overhead worst case) and 102 speedy module that guarentees only 1 byte overhead worst case) and
85 Compress::Zlib. 103 Compress::Zlib.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines