* of the decoder before upgrading to version 2 of the
* encoder!
+2.04 Wed Mar 5 18:15 2014 (AMS time)
+ - Fix rt.cpan.org #93484 - fencepost error in Encoder.xs (Zefram)
+
2.03 Tue Jan 7 20:00 2014 (AMS time)
- (Hopefully) final fixes to FREEZE/THAW functionality:
=> Add safe assertion to make sure that we don't segfault on invalid
SV *hdr_user_data_src = NULL;
PPCODE:
assert(enc != NULL);
- if (items >= 2 && SvOK(ST(2)))
+ if (items > 2 && SvOK(ST(2)))
hdr_user_data_src = ST(2);
srl_dump_data_structure(aTHX_ enc, src, hdr_user_data_src);
assert(enc->buf.pos > enc->buf.start);
t/010_desperate.t
t/020_sort_keys.t
t/021_sort_keys_option.t
-t/100_roundtrip.t
-t/101_roundtrip_v1.t
t/110_nobless.t
t/120_hdr_data.t
t/130_freezethaw.t
t/200_bulk.t
t/300_fail.t
t/400_evil.t
+t/700_roundtrip.t
+t/701_roundtrip_v1.t
t/800_threads.t
t/data/corpus
t/lib/Sereal/BulkTest.pm
t/lib/Sereal/TestSet.pm
typemap
-META.yml Module YAML meta-data (added by MakeMaker)
-META.json Module JSON meta-data (added by MakeMaker)
+META.yml Module meta-data (added by MakeMaker)
+++ /dev/null
-{
- "abstract" : "Fast, compact, powerful binary serialization",
- "author" : [
- "Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>"
- ],
- "dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921",
- "license" : [
- "perl_5"
- ],
- "meta-spec" : {
- "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
- },
- "name" : "Sereal-Encoder",
- "no_index" : {
- "directory" : [
- "t",
- "inc"
- ]
- },
- "prereqs" : {
- "build" : {
- "requires" : {
- "Data::Dumper" : "0",
- "ExtUtils::ParseXS" : "2.21",
- "File::Find" : "0",
- "File::Path" : "0",
- "File::Spec" : "0",
- "Scalar::Util" : "0",
- "Sereal::Decoder" : "2.03",
- "Test::LongString" : "0",
- "Test::More" : "0.88",
- "Test::Warn" : "0"
- }
- },
- "configure" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "0"
- }
- },
- "runtime" : {
- "requires" : {
- "XSLoader" : "0",
- "perl" : "5.008"
- }
- }
- },
- "release_status" : "stable",
- "resources" : {
- "bugtracker" : {
- "web" : "https://github.com/Sereal/Sereal/issues"
- },
- "repository" : {
- "url" : "git://github.com/Sereal/Sereal.git"
- }
- },
- "version" : "2.03"
-}
----
-abstract: 'Fast, compact, powerful binary serialization'
+--- #YAML:1.0
+name: Sereal-Encoder
+version: 2.04
+abstract: Fast, compact, powerful binary serialization
author:
- - 'Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>'
-build_requires:
- Data::Dumper: 0
- ExtUtils::ParseXS: 2.21
- File::Find: 0
- File::Path: 0
- File::Spec: 0
- Scalar::Util: 0
- Sereal::Decoder: 2.03
- Test::LongString: 0
- Test::More: 0.88
- Test::Warn: 0
+ - Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>
+license: perl
+distribution_type: module
configure_requires:
- ExtUtils::MakeMaker: 0
-dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921'
-license: perl
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
-name: Sereal-Encoder
-no_index:
- directory:
- - t
- - inc
+ ExtUtils::MakeMaker: 0
+build_requires:
+ Data::Dumper: 0
+ ExtUtils::ParseXS: 2.21
+ File::Find: 0
+ File::Path: 0
+ File::Spec: 0
+ Scalar::Util: 0
+ Sereal::Decoder: 2.03
+ Test::LongString: 0
+ Test::More: 0.88
+ Test::Warn: 0
requires:
- XSLoader: 0
- perl: 5.008
+ perl: 5.008
+ XSLoader: 0
resources:
- bugtracker: https://github.com/Sereal/Sereal/issues
- repository: git://github.com/Sereal/Sereal.git
-version: 2.03
+ bugtracker: https://github.com/Sereal/Sereal/issues
+ repository: git://github.com/Sereal/Sereal.git
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.57_05
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
while ($len--) {
my $t = substr($data, 0, 1);
my $o = ord($t);
- print( " ", $ind, ($flipflop++ % 2 == 1 ? "VALUE" : "KEY"), ":\n" );
+ printf "$fmt2%s:\n",("") x $lead_items, $ind, ($flipflop++ %2 == 1 ? "VALUE" : "KEY");
parse_sv($ind." ");
}
}
use Carp qw/croak/;
use XSLoader;
-our $VERSION = '2.03'; # Don't forget to update the TestCompat set for testing against installed decoders!
+our $VERSION = '2.04'; # Don't forget to update the TestCompat set for testing against installed decoders!
# not for public consumption, just for testing.
(my $num_version = $VERSION) =~ s/_//;
L<https://github.com/Sereal/Sereal/blob/master/README.pod>, and the output
of our benchmarks can be seen at
L<https://github.com/Sereal/Sereal/wiki/Sereal-Comparison-Graphs>.
+For more information on getting the best performance out of Sereal, have a look
+at the L</"PERFORMANCE"> section below.
=head1 CLASS METHODS
=head3 no_shared_hashkeys
-When the C<no_shared_hashkeys> option is set ot a true value, then
+When the C<no_shared_hashkeys> option is set to a true value, then
the encoder will disable the detection and elimination of repeated hash
keys. This only has an effect for serializing structures containing hashes.
By skipping the detection of repeated hash keys, performance goes up a bit,
If this is option is enabled/true then Sereal will use a hash to encode duplicates
of strings during serialization efficiently using (internal) backreferences. This
-has a peformance and memory penalty during encoding so it defaults to off.
+has a performance and memory penalty during encoding so it defaults to off.
On the other hand, data structures with many duplicated strings will see a
significant reduction in the size of the encoded form. Currently only strings
longer than 3 characters will be deduped, however this may change in the future.
and if both options are set, I<aliased_dedupe_strings> takes precedence.
The behaviour of I<aliased_dedupe_strings> differs from I<dedupe_strings>
-in that the duplicate occurrances of strings are emitted as Perl language
+in that the duplicate occurrences of strings are emitted as Perl language
level B<aliases> instead of as Sereal-internal backreferences. This means
that using this option actually produces a different output data structure
when decoding. The upshot is that with this option, the application
Expects a data structure to serialize as first argument, optionally followed
by a hash reference of options (see documentation for C<new()>).
-The functional interface is marginally slower than the OO interface since
+The functional interface is quite a bit slower than the OO interface since
it cannot reuse the encoder object.
=head1 PERFORMANCE
+If you care about performance at all, then use the object-oriented interface
+instead of the functional interface. It's a significant difference in performance
+if you are serializing small data structures.
+
The exact performance in time and space depends heavily on the data structure
-to be serialized. For ready-made comparison scripts, see the
+to be serialized. Often there is a trade-off between space and time. If in doubt,
+do your own testing and most importantly ALWAYS TEST WITH REAL DATA. If you
+care purely about speed at the expense of output size, you can use the
+C<no_shared_hashkeys> option for a small speed-up. If you need smaller output at
+the cost of higher CPU load and more memory used during encoding/decoding,
+try the C<dedupe_strings> option and enable Snappy compression.
+
+For ready-made comparison scripts, see the
F<author_tools/bench.pl> and F<author_tools/dbench.pl> programs that are part
of this distribution. Suffice to say that this library is easily competitive
in both time and space efficiency with the best alternatives.
This should not be any practical limitation whatsoever. Just return an array
reference instead of a list.
-Here is a contrived example of a class implementing the C<FREEZE> / C<THAW> mechansim.
+Here is a contrived example of a class implementing the C<FREEZE> / C<THAW> mechanism.
package
File;
Similar to how Sereal can represent arrays and hashes in a full and a compact
form. For small integers (between -16 and +15 inclusive), Sereal emits only
one byte including the encoding of the type of data. For larger integers,
-it can use either varints (positive only) or zigzag encoding, which can also
+it can use either variants (positive only) or zigzag encoding, which can also
represent negative numbers. For a canonical mode, the space optimizations
would have to be turned off and it would have to be explicitly specified
-whether varint or zigzag encoding is to be used for encoding positive
+whether variant or zigzag encoding is to be used for encoding positive
integers.
Perl may choose to retain multiple representations of a scalar. Specifically,
Sereal development list:
L<https://groups.google.com/forum/?fromgroups#!forum/sereal-dev>
-=head1 AUTHORS
+=head1 AUTHORS AND CONTRIBUTORS
Yves Orton E<lt>demerphq@gmail.comE<gt>
Daniel Dragan E<lt>bulkdd@cpan.orgE<gt> (Windows support and bugfixes)
+Zefram
+
Some inspiration and code was taken from Marc Lehmann's
excellent L<JSON::XS> module due to obvious overlap in
problem domain. Thank you!
+++ /dev/null
-#!perl
-use strict;
-use warnings;
-use Sereal::Encoder;
-use Data::Dumper;
-use File::Spec;
-
-# These tests use an installed Decoder (or respectively Encoder) to do
-# round-trip testing. There are two strategies, both with drawbacks:
-# - Test::More's is_deeply is waaaay too lenient to catch all the
-# subtleties that Sereal is supposed to encode.
-# - Serialize - Deserialize - Serialize, then do a string compare.
-# This won't catch if the first serialization has bogus output
-# but the subsequent de- & serialization work for the already
-# bogus output.
-# These tests can't replace carefully crafted manual tests, I fear.
-
-use lib File::Spec->catdir(qw(t lib));
-BEGIN {
- lib->import('lib')
- if !-d 't';
-}
-
-use Sereal::TestSet qw(:all);
-use Test::More;
-
-my $ok = have_encoder_and_decoder();
-if (not $ok) {
- plan skip_all => 'Did not find right version of decoder';
-}
-else {
- run_roundtrip_tests(2); # 2 is "run for proto version 2 only"
-}
-
-
-pass();
-done_testing();
-
+++ /dev/null
-#!perl
-use strict;
-use warnings;
-use Sereal::Encoder;
-use Data::Dumper;
-use File::Spec;
-
-# These tests use an installed Decoder (or respectively Encoder) to do
-# round-trip testing. There are two strategies, both with drawbacks:
-# - Test::More's is_deeply is waaaay too lenient to catch all the
-# subtleties that Sereal is supposed to encode.
-# - Serialize - Deserialize - Serialize, then do a string compare.
-# This won't catch if the first serialization has bogus output
-# but the subsequent de- & serialization work for the already
-# bogus output.
-# These tests can't replace carefully crafted manual tests, I fear.
-
-use lib File::Spec->catdir(qw(t lib));
-BEGIN {
- lib->import('lib')
- if !-d 't';
-}
-
-use Sereal::TestSet qw(:all);
-use Test::More;
-
-my $ok = have_encoder_and_decoder();
-if (not $ok) {
- plan skip_all => 'Did not find right version of decoder';
-}
-else {
- run_roundtrip_tests(1); # 1 is "run for proto-version 1 only"
-}
-
-
-pass();
-done_testing();
-
--- /dev/null
+#!perl
+use strict;
+use warnings;
+use Sereal::Encoder;
+use Data::Dumper;
+use File::Spec;
+
+# These tests use an installed Decoder (or respectively Encoder) to do
+# round-trip testing. There are two strategies, both with drawbacks:
+# - Test::More's is_deeply is waaaay too lenient to catch all the
+# subtleties that Sereal is supposed to encode.
+# - Serialize - Deserialize - Serialize, then do a string compare.
+# This won't catch if the first serialization has bogus output
+# but the subsequent de- & serialization work for the already
+# bogus output.
+# These tests can't replace carefully crafted manual tests, I fear.
+
+use lib File::Spec->catdir(qw(t lib));
+BEGIN {
+ lib->import('lib')
+ if !-d 't';
+}
+
+use Sereal::TestSet qw(:all);
+use Test::More;
+
+my $ok = have_encoder_and_decoder();
+if (not $ok) {
+ plan skip_all => 'Did not find right version of decoder';
+}
+else {
+ run_roundtrip_tests(2); # 2 is "run for proto version 2 only"
+}
+
+
+pass();
+done_testing();
+
--- /dev/null
+#!perl
+use strict;
+use warnings;
+use Sereal::Encoder;
+use Data::Dumper;
+use File::Spec;
+
+# These tests use an installed Decoder (or respectively Encoder) to do
+# round-trip testing. There are two strategies, both with drawbacks:
+# - Test::More's is_deeply is waaaay too lenient to catch all the
+# subtleties that Sereal is supposed to encode.
+# - Serialize - Deserialize - Serialize, then do a string compare.
+# This won't catch if the first serialization has bogus output
+# but the subsequent de- & serialization work for the already
+# bogus output.
+# These tests can't replace carefully crafted manual tests, I fear.
+
+use lib File::Spec->catdir(qw(t lib));
+BEGIN {
+ lib->import('lib')
+ if !-d 't';
+}
+
+use Sereal::TestSet qw(:all);
+use Test::More;
+
+my $ok = have_encoder_and_decoder();
+if (not $ok) {
+ plan skip_all => 'Did not find right version of decoder';
+}
+else {
+ run_roundtrip_tests(1); # 1 is "run for proto-version 1 only"
+}
+
+
+pass();
+done_testing();
+