ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.pm
(Generate patch)

Comparing JSON-XS/XS.pm (file contents):
Revision 1.23 by root, Sun Mar 25 21:19:13 2007 UTC vs.
Revision 1.24 by root, Thu Mar 29 01:27:36 2007 UTC

284 => "Hello, World!" 284 => "Hello, World!"
285 285
286=item $json = $json->shrink ([$enable]) 286=item $json = $json->shrink ([$enable])
287 287
288Perl usually over-allocates memory a bit when allocating space for 288Perl usually over-allocates memory a bit when allocating space for
289strings. This flag optionally resizes strings generated by either 289strings. This flag optionally resizes strings generated by either
290C<encode> or C<decode> to their minimum size possible. This can save 290C<encode> or C<decode> to their minimum size possible. This can save
291memory when your JSON texts are either very very long or you have many 291memory when your JSON texts are either very very long or you have many
292short strings. It will also try to downgrade any strings to octet-form 292short strings. It will also try to downgrade any strings to octet-form
293if possible: perl stores strings internally either in an encoding called 293if possible: perl stores strings internally either in an encoding called
294UTF-X or in octet-form. The latter cannot store everything but uses less 294UTF-X or in octet-form. The latter cannot store everything but uses less
295space in general. 295space in general (and some buggy Perl or C code might even rely on that
296internal representation being used).
296 297
298The actual definition of what shrink does might change in future versions,
299but it will always try to save space at the expense of time.
300
297If C<$enable> is true (or missing), the string returned by C<encode> will be shrunk-to-fit, 301If C<$enable> is true (or missing), the string returned by C<encode> will
298while all strings generated by C<decode> will also be shrunk-to-fit. 302be shrunk-to-fit, while all strings generated by C<decode> will also be
303shrunk-to-fit.
299 304
300If C<$enable> is false, then the normal perl allocation algorithms are used. 305If C<$enable> is false, then the normal perl allocation algorithms are used.
301If you work with your data, then this is likely to be faster. 306If you work with your data, then this is likely to be faster.
302 307
303In the future, this setting might control other things, such as converting 308In the future, this setting might control other things, such as converting

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines