← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Sereal/Decoder.pm
StatementsExecuted 25 statements in 1.06ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
10001114.1ms14.1msSereal::Decoder::::decode_serealSereal::Decoder::decode_sereal (xsub)
11123µs23µsSereal::Decoder::::BEGIN@2Sereal::Decoder::BEGIN@2
11121µs343µsSereal::Decoder::::BEGIN@33Sereal::Decoder::BEGIN@33
11110µs14µsSereal::Decoder::::BEGIN@3Sereal::Decoder::BEGIN@3
1118µs19µsSereal::Decoder::::BEGIN@4Sereal::Decoder::BEGIN@4
1118µs16µsSereal::Decoder::::BEGIN@16Sereal::Decoder::BEGIN@16
1117µs53µsSereal::Decoder::::BEGIN@5Sereal::Decoder::BEGIN@5
1115µs5µsSereal::Decoder::::BEGIN@6Sereal::Decoder::BEGIN@6
1114µs4µsSereal::Decoder::::CORE:substSereal::Decoder::CORE:subst (opcode)
0000s0sSereal::Decoder::::CLONE_SKIPSereal::Decoder::CLONE_SKIP
0000s0sSereal::Decoder::::__ANON__[:135]Sereal::Decoder::__ANON__[:135]
0000s0sSereal::Decoder::::_test_compatSereal::Decoder::_test_compat
0000s0sSereal::Decoder::::decode_from_fileSereal::Decoder::decode_from_file
0000s0sSereal::Decoder::::flag_namesSereal::Decoder::flag_names
0000s0sSereal::Decoder::::flag_names_staticSereal::Decoder::flag_names_static
0000s0sSereal::Decoder::::flag_names_volatileSereal::Decoder::flag_names_volatile
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Sereal::Decoder;
2253µs123µs
# spent 23µs within Sereal::Decoder::BEGIN@2 which was called: # once (23µs+0s) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 2
use 5.008;
# spent 23µs making 1 call to Sereal::Decoder::BEGIN@2
3227µs219µs
# spent 14µs (10+4) within Sereal::Decoder::BEGIN@3 which was called: # once (10µs+4µs) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 3
use strict;
# spent 14µs making 1 call to Sereal::Decoder::BEGIN@3 # spent 4µs making 1 call to strict::import
4224µs230µs
# spent 19µs (8+11) within Sereal::Decoder::BEGIN@4 which was called: # once (8µs+11µs) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 4
use warnings;
# spent 19µs making 1 call to Sereal::Decoder::BEGIN@4 # spent 11µs making 1 call to warnings::import
5222µs299µs
# spent 53µs (7+46) within Sereal::Decoder::BEGIN@5 which was called: # once (7µs+46µs) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 5
use Carp qw/croak/;
# spent 53µs making 1 call to Sereal::Decoder::BEGIN@5 # spent 46µs making 1 call to Exporter::import
62134µs15µs
# spent 5µs within Sereal::Decoder::BEGIN@6 which was called: # once (5µs+0s) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 6
use XSLoader;
# spent 5µs making 1 call to Sereal::Decoder::BEGIN@6
7
81400nsour $VERSION = '3.014'; # Don't forget to update the TestCompat set for testing against installed encoders!
9213µsour $XS_VERSION = $VERSION; $VERSION= eval $VERSION;
# spent 2µs executing statements in string eval
10
11# not for public consumption, just for testing.
12110µs14µs(my $num_version = $VERSION) =~ s/_//;
# spent 4µs making 1 call to Sereal::Decoder::CORE:subst
13120µsmy $TestCompat = [ map sprintf("%.2f", $_/100), reverse( 300 .. int($num_version * 100) ) ]; # compat with 3.00 to ...
14sub _test_compat { return(@$TestCompat, $VERSION) }
15
162205µs224µs
# spent 16µs (8+8) within Sereal::Decoder::BEGIN@16 which was called: # once (8µs+8µs) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 16
use Exporter 'import';
# spent 16µs making 1 call to Sereal::Decoder::BEGIN@16 # spent 8µs making 1 call to Exporter::import
1711µsour @EXPORT_OK = qw(
18 decode_sereal looks_like_sereal decode_sereal_with_header_data
19 scalar_looks_like_sereal
20 sereal_decode_with_object sereal_decode_with_header_with_object
21 sereal_decode_only_header_with_object
22 sereal_decode_only_header_with_offset_with_object
23 sereal_decode_with_header_and_offset_with_object
24 sereal_decode_with_offset_with_object
25);
2612µsour %EXPORT_TAGS = (all => \@EXPORT_OK);
27# export by default if run from command line
2812µsour @EXPORT = ((caller())[1] eq '-e' ? @EXPORT_OK : ());
29
30sub CLONE_SKIP { 1 }
311240µs1232µsXSLoader::load('Sereal::Decoder', $XS_VERSION);
# spent 232µs making 1 call to XSLoader::load
32use constant #begin generated
33
# spent 343µs (21+322) within Sereal::Decoder::BEGIN@33 which was called: # once (21µs+322µs) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 111
{
34119µs1322µs 'SRL_F_DECODER_ALIAS_CHECK_FLAGS' => 28672,
# spent 322µs making 1 call to constant::import
35 'SRL_F_DECODER_ALIAS_SMALLINT' => 4096,
36 'SRL_F_DECODER_ALIAS_VARINT' => 8192,
37 'SRL_F_DECODER_DECOMPRESS_SNAPPY' => 8,
38 'SRL_F_DECODER_DECOMPRESS_ZLIB' => 16,
39 'SRL_F_DECODER_DESTRUCTIVE_INCREMENTAL' => 1024,
40 'SRL_F_DECODER_DIRTY' => 2,
41 'SRL_F_DECODER_NEEDS_FINALIZE' => 4,
42 'SRL_F_DECODER_NO_BLESS_OBJECTS' => 512,
43 'SRL_F_DECODER_PROTOCOL_V1' => 2048,
44 'SRL_F_DECODER_READONLY_FLAGS' => 98304,
45 'SRL_F_DECODER_REFUSE_OBJECTS' => 128,
46 'SRL_F_DECODER_REFUSE_SNAPPY' => 32,
47 'SRL_F_DECODER_REFUSE_ZLIB' => 64,
48 'SRL_F_DECODER_REUSE' => 1,
49 'SRL_F_DECODER_SET_READONLY' => 32768,
50 'SRL_F_DECODER_SET_READONLY_SCALARS' => 65536,
51 'SRL_F_DECODER_USE_UNDEF' => 16384,
52 'SRL_F_DECODER_VALIDATE_UTF8' => 256,
53 'SRL_F_DECODER_VOLATILE_FLAGS' => 2078,
54 '_FLAG_NAME' => [
55 'REUSE',
56 'DIRTY',
57 'NEEDS_FINALIZE',
58 'DECOMPRESS_SNAPPY',
59 'DECOMPRESS_ZLIB',
60 'REFUSE_SNAPPY',
61 'REFUSE_ZLIB',
62 'REFUSE_OBJECTS',
63 'VALIDATE_UTF8',
64 'NO_BLESS_OBJECTS',
65 'DESTRUCTIVE_INCREMENTAL',
66 'PROTOCOL_V1',
67 'ALIAS_SMALLINT',
68 'ALIAS_VARINT',
69 'USE_UNDEF',
70 'SET_READONLY',
71 'SET_READONLY_SCALARS'
72 ],
73 '_FLAG_NAME_STATIC' => [
74 'REUSE',
75 undef,
76 undef,
77 undef,
78 undef,
79 'REFUSE_SNAPPY',
80 'REFUSE_ZLIB',
81 'REFUSE_OBJECTS',
82 'VALIDATE_UTF8',
83 'NO_BLESS_OBJECTS',
84 'DESTRUCTIVE_INCREMENTAL',
85 undef,
86 'ALIAS_SMALLINT',
87 'ALIAS_VARINT',
88 'USE_UNDEF',
89 'SET_READONLY',
90 'SET_READONLY_SCALARS'
91 ],
92 '_FLAG_NAME_VOLATILE' => [
93 undef,
94 'DIRTY',
95 'NEEDS_FINALIZE',
96 'DECOMPRESS_SNAPPY',
97 'DECOMPRESS_ZLIB',
98 undef,
99 undef,
100 undef,
101 undef,
102 undef,
103 undef,
104 'PROTOCOL_V1',
105 undef,
106 undef,
107 undef,
108 undef,
109 undef
110 ]
1111271µs1343µs}; #end generated
# spent 343µs making 1 call to Sereal::Decoder::BEGIN@33
112
113sub decode_from_file {
114 my ($self, $file, )= @_; # pos 3 is "target var" if one is provided
115 open my $fh, "<", $file
116 or die "Failed to open '$file' for read: $!";
117 my $buf= do{ local $/; <> };
118 close $fh
119 or die "Failed to close '$file': $!";
120 if (wantarray && ($self->flags & SRL_F_DECODER_DESTRUCTIVE_INCREMENTAL)) {
121 my @ret;
122 while (length $buf) {
123 push @ret, $self->decode($buf);
124 }
125 return @ret;
126 }
127 return $self->decode($file, $_[2]);
128}
129
130my $flags= sub {
131 my ($int, $ary)= @_;
132 return map {
133 ($ary->[$_] and $int & (1 << $_)) ? $ary->[$_] : ()
134 } (0..$#$ary);
13512µs};
136
137sub flag_names {
138 my ($self, $val)= @_;
139 return $flags->(defined $val ? $val : $self->flags, _FLAG_NAME);
140}
141
142sub flag_names_volatile {
143 my ($self, $val)= @_;
144 return $flags->($val // $self->flags, _FLAG_NAME_VOLATILE);
145}
146
147sub flag_names_static {
148 my ($self, $val)= @_;
149 return $flags->($val // $self->flags, _FLAG_NAME_STATIC);
150}
151
152110µs1;
153
154__END__
 
# spent 4µs within Sereal::Decoder::CORE:subst which was called: # once (4µs+0s) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 12
sub Sereal::Decoder::CORE:subst; # opcode
# spent 14.1ms within Sereal::Decoder::decode_sereal which was called 1000 times, avg 14µs/call: # 1000 times (14.1ms+0s) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 437 of BenchmarkAnything/Storage/Backend/SQL.pm, avg 14µs/call
sub Sereal::Decoder::decode_sereal; # xsub