| Filename | /usr/lib64/perl5/vendor_perl/5.16.0/JSON.pm |
| Statements | Executed 83 statements in 18.2ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 8.88ms | 87.0ms | JSON::_load_xs |
| 1 | 1 | 1 | 2.61ms | 2.61ms | JSON::CORE:readline (opcode) |
| 2 | 2 | 1 | 1.57ms | 12.2ms | JSON::Boolean::_overrride_overload |
| 1 | 1 | 1 | 448µs | 448µs | JSON::_set_module |
| 1 | 1 | 1 | 103µs | 886µs | JSON::import |
| 1 | 1 | 1 | 96µs | 196µs | JSON::BEGIN@4 |
| 1 | 1 | 1 | 74µs | 164µs | JSON::BEGIN@318 |
| 1 | 1 | 1 | 66µs | 66µs | JSON::CORE:close (opcode) |
| 1 | 1 | 1 | 62µs | 146µs | JSON::Backend::PP::BEGIN@383 |
| 1 | 1 | 1 | 54µs | 419µs | JSON::BEGIN@6 |
| 1 | 1 | 1 | 27µs | 27µs | JSON::BEGIN@9 |
| 1 | 1 | 1 | 24µs | 24µs | JSON::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | JSON::Backend::PP::__ANON__[:386] |
| 0 | 0 | 0 | 0s | 0s | JSON::Backend::PP::__ANON__[:387] |
| 0 | 0 | 0 | 0s | 0s | JSON::Backend::PP::init |
| 0 | 0 | 0 | 0s | 0s | JSON::__ANON__[:332] |
| 0 | 0 | 0 | 0s | 0s | JSON::_load_pp |
| 0 | 0 | 0 | 0s | 0s | JSON::backend |
| 0 | 0 | 0 | 0s | 0s | JSON::false |
| 0 | 0 | 0 | 0s | 0s | JSON::from_json |
| 0 | 0 | 0 | 0s | 0s | JSON::is_pp |
| 0 | 0 | 0 | 0s | 0s | JSON::is_xs |
| 0 | 0 | 0 | 0s | 0s | JSON::jsonToObj |
| 0 | 0 | 0 | 0s | 0s | JSON::null |
| 0 | 0 | 0 | 0s | 0s | JSON::objToJson |
| 0 | 0 | 0 | 0s | 0s | JSON::property |
| 0 | 0 | 0 | 0s | 0s | JSON::pureperl_only_methods |
| 0 | 0 | 0 | 0s | 0s | JSON::require_xs_version |
| 0 | 0 | 0 | 0s | 0s | JSON::to_json |
| 0 | 0 | 0 | 0s | 0s | JSON::true |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package JSON; | ||||
| 2 | |||||
| 3 | |||||
| 4 | 2 | 150µs | 2 | 296µs | # spent 196µs (96+100) within JSON::BEGIN@4 which was called:
# once (96µs+100µs) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 4 # spent 196µs making 1 call to JSON::BEGIN@4
# spent 100µs making 1 call to strict::import |
| 5 | 2 | 147µs | 1 | 24µs | # spent 24µs within JSON::BEGIN@5 which was called:
# once (24µs+0s) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 5 # spent 24µs making 1 call to JSON::BEGIN@5 |
| 6 | 2 | 363µs | 2 | 784µs | # spent 419µs (54+365) within JSON::BEGIN@6 which was called:
# once (54µs+365µs) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 6 # spent 419µs making 1 call to JSON::BEGIN@6
# spent 365µs making 1 call to base::import |
| 7 | 1 | 11µs | @JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json decode_json); | ||
| 8 | |||||
| 9 | # spent 27µs within JSON::BEGIN@9 which was called:
# once (27µs+0s) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 13 | ||||
| 10 | 1 | 2µs | $JSON::VERSION = '2.53'; | ||
| 11 | 1 | 2µs | $JSON::DEBUG = 0 unless (defined $JSON::DEBUG); | ||
| 12 | 1 | 26µs | $JSON::DEBUG = $ENV{ PERL_JSON_DEBUG } if exists $ENV{ PERL_JSON_DEBUG }; | ||
| 13 | 1 | 7.40ms | 1 | 27µs | } # spent 27µs making 1 call to JSON::BEGIN@9 |
| 14 | |||||
| 15 | 1 | 2µs | my $Module_XS = 'JSON::XS'; | ||
| 16 | 1 | 1µs | my $Module_PP = 'JSON::PP'; | ||
| 17 | 1 | 3µs | my $Module_bp = 'JSON::backportPP'; # included in JSON distribution | ||
| 18 | 1 | 1µs | my $PP_Version = '2.27200'; | ||
| 19 | 1 | 1µs | my $XS_Version = '2.27'; | ||
| 20 | |||||
| 21 | |||||
| 22 | # XS and PP common methods | ||||
| 23 | |||||
| 24 | 1 | 16µs | my @PublicMethods = qw/ | ||
| 25 | ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref | ||||
| 26 | allow_blessed convert_blessed filter_json_object filter_json_single_key_object | ||||
| 27 | shrink max_depth max_size encode decode decode_prefix allow_unknown | ||||
| 28 | /; | ||||
| 29 | |||||
| 30 | 1 | 11µs | my @Properties = qw/ | ||
| 31 | ascii latin1 utf8 indent space_before space_after relaxed canonical allow_nonref | ||||
| 32 | allow_blessed convert_blessed shrink max_depth max_size allow_unknown | ||||
| 33 | /; | ||||
| 34 | |||||
| 35 | 1 | 2µs | my @XSOnlyMethods = qw//; # Currently nothing | ||
| 36 | |||||
| 37 | 1 | 7µs | my @PPOnlyMethods = qw/ | ||
| 38 | indent_length sort_by | ||||
| 39 | allow_singlequote allow_bignum loose allow_barekey escape_slash as_nonblessed | ||||
| 40 | /; # JSON::PP specific | ||||
| 41 | |||||
| 42 | |||||
| 43 | # used in _load_xs and _load_pp ($INSTALL_ONLY is not used currently) | ||||
| 44 | 1 | 2µs | my $_INSTALL_DONT_DIE = 1; # When _load_xs fails to load XS, don't die. | ||
| 45 | 1 | 700ns | my $_INSTALL_ONLY = 2; # Don't call _set_methods() | ||
| 46 | 1 | 700ns | my $_ALLOW_UNSUPPORTED = 0; | ||
| 47 | 1 | 700ns | my $_UNIV_CONV_BLESSED = 0; | ||
| 48 | 1 | 700ns | my $_USSING_bpPP = 0; | ||
| 49 | |||||
| 50 | |||||
| 51 | # Check the environment variable to decide worker module. | ||||
| 52 | |||||
| 53 | 1 | 3µs | unless ($JSON::Backend) { | ||
| 54 | 1 | 500ns | $JSON::DEBUG and Carp::carp("Check used worker module..."); | ||
| 55 | |||||
| 56 | 1 | 3µs | my $backend = exists $ENV{PERL_JSON_BACKEND} ? $ENV{PERL_JSON_BACKEND} : 1; | ||
| 57 | |||||
| 58 | 1 | 20µs | 1 | 87.0ms | if ($backend eq '1' or $backend =~ /JSON::XS\s*,\s*JSON::PP/) { # spent 87.0ms making 1 call to JSON::_load_xs |
| 59 | _load_xs($_INSTALL_DONT_DIE) or _load_pp(); | ||||
| 60 | } | ||||
| 61 | elsif ($backend eq '0' or $backend eq 'JSON::PP') { | ||||
| 62 | _load_pp(); | ||||
| 63 | } | ||||
| 64 | elsif ($backend eq '2' or $backend eq 'JSON::XS') { | ||||
| 65 | _load_xs(); | ||||
| 66 | } | ||||
| 67 | elsif ($backend eq 'JSON::backportPP') { | ||||
| 68 | $_USSING_bpPP = 1; | ||||
| 69 | _load_pp(); | ||||
| 70 | } | ||||
| 71 | else { | ||||
| 72 | Carp::croak "The value of environmental variable 'PERL_JSON_BACKEND' is invalid."; | ||||
| 73 | } | ||||
| 74 | } | ||||
| 75 | |||||
| 76 | |||||
| 77 | # spent 886µs (103+782) within JSON::import which was called:
# once (103µs+782µs) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 20 of webmerge/scripts/modules/RTP/Webmerge/Embedder/JS.pm | ||||
| 78 | 1 | 4µs | my $pkg = shift; | ||
| 79 | 1 | 2µs | my @what_to_export; | ||
| 80 | 1 | 700ns | my $no_export; | ||
| 81 | |||||
| 82 | 1 | 7µs | for my $tag (@_) { | ||
| 83 | 1 | 5µs | if ($tag eq '-support_by_pp') { | ||
| 84 | if (!$_ALLOW_UNSUPPORTED++) { | ||||
| 85 | JSON::Backend::XS | ||||
| 86 | ->support_by_pp(@PPOnlyMethods) if ($JSON::Backend eq $Module_XS); | ||||
| 87 | } | ||||
| 88 | next; | ||||
| 89 | } | ||||
| 90 | elsif ($tag eq '-no_export') { | ||||
| 91 | $no_export++, next; | ||||
| 92 | } | ||||
| 93 | elsif ( $tag eq '-convert_blessed_universally' ) { | ||||
| 94 | eval q| | ||||
| 95 | require B; | ||||
| 96 | *UNIVERSAL::TO_JSON = sub { | ||||
| 97 | my $b_obj = B::svref_2object( $_[0] ); | ||||
| 98 | return $b_obj->isa('B::HV') ? { %{ $_[0] } } | ||||
| 99 | : $b_obj->isa('B::AV') ? [ @{ $_[0] } ] | ||||
| 100 | : undef | ||||
| 101 | ; | ||||
| 102 | } | ||||
| 103 | | if ( !$_UNIV_CONV_BLESSED++ ); | ||||
| 104 | next; | ||||
| 105 | } | ||||
| 106 | 1 | 8µs | push @what_to_export, $tag; | ||
| 107 | } | ||||
| 108 | |||||
| 109 | 1 | 1µs | return if ($no_export); | ||
| 110 | |||||
| 111 | 1 | 54µs | 1 | 116µs | __PACKAGE__->export_to_level(1, $pkg, @what_to_export); # spent 116µs making 1 call to Exporter::export_to_level |
| 112 | } | ||||
| 113 | |||||
| 114 | |||||
| 115 | # OBSOLETED | ||||
| 116 | |||||
| 117 | sub jsonToObj { | ||||
| 118 | my $alternative = 'from_json'; | ||||
| 119 | if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) { | ||||
| 120 | shift @_; $alternative = 'decode'; | ||||
| 121 | } | ||||
| 122 | Carp::carp "'jsonToObj' will be obsoleted. Please use '$alternative' instead."; | ||||
| 123 | return JSON::from_json(@_); | ||||
| 124 | }; | ||||
| 125 | |||||
| 126 | sub objToJson { | ||||
| 127 | my $alternative = 'to_json'; | ||||
| 128 | if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) { | ||||
| 129 | shift @_; $alternative = 'encode'; | ||||
| 130 | } | ||||
| 131 | Carp::carp "'objToJson' will be obsoleted. Please use '$alternative' instead."; | ||||
| 132 | JSON::to_json(@_); | ||||
| 133 | }; | ||||
| 134 | |||||
| 135 | |||||
| 136 | # INTERFACES | ||||
| 137 | |||||
| 138 | sub to_json ($@) { | ||||
| 139 | if ( | ||||
| 140 | ref($_[0]) eq 'JSON' | ||||
| 141 | or (@_ > 2 and $_[0] eq 'JSON') | ||||
| 142 | ) { | ||||
| 143 | Carp::croak "to_json should not be called as a method."; | ||||
| 144 | } | ||||
| 145 | my $json = new JSON; | ||||
| 146 | |||||
| 147 | if (@_ == 2 and ref $_[1] eq 'HASH') { | ||||
| 148 | my $opt = $_[1]; | ||||
| 149 | for my $method (keys %$opt) { | ||||
| 150 | $json->$method( $opt->{$method} ); | ||||
| 151 | } | ||||
| 152 | } | ||||
| 153 | |||||
| 154 | $json->encode($_[0]); | ||||
| 155 | } | ||||
| 156 | |||||
| 157 | |||||
| 158 | sub from_json ($@) { | ||||
| 159 | if ( ref($_[0]) eq 'JSON' or $_[0] eq 'JSON' ) { | ||||
| 160 | Carp::croak "from_json should not be called as a method."; | ||||
| 161 | } | ||||
| 162 | my $json = new JSON; | ||||
| 163 | |||||
| 164 | if (@_ == 2 and ref $_[1] eq 'HASH') { | ||||
| 165 | my $opt = $_[1]; | ||||
| 166 | for my $method (keys %$opt) { | ||||
| 167 | $json->$method( $opt->{$method} ); | ||||
| 168 | } | ||||
| 169 | } | ||||
| 170 | |||||
| 171 | return $json->decode( $_[0] ); | ||||
| 172 | } | ||||
| 173 | |||||
| 174 | |||||
| 175 | sub true { $JSON::true } | ||||
| 176 | |||||
| 177 | sub false { $JSON::false } | ||||
| 178 | |||||
| 179 | sub null { undef; } | ||||
| 180 | |||||
| 181 | |||||
| 182 | sub require_xs_version { $XS_Version; } | ||||
| 183 | |||||
| 184 | sub backend { | ||||
| 185 | my $proto = shift; | ||||
| 186 | $JSON::Backend; | ||||
| 187 | } | ||||
| 188 | |||||
| 189 | #*module = *backend; | ||||
| 190 | |||||
| 191 | |||||
| 192 | sub is_xs { | ||||
| 193 | return $_[0]->module eq $Module_XS; | ||||
| 194 | } | ||||
| 195 | |||||
| 196 | |||||
| 197 | sub is_pp { | ||||
| 198 | return not $_[0]->xs; | ||||
| 199 | } | ||||
| 200 | |||||
| 201 | |||||
| 202 | sub pureperl_only_methods { @PPOnlyMethods; } | ||||
| 203 | |||||
| 204 | |||||
| 205 | sub property { | ||||
| 206 | my ($self, $name, $value) = @_; | ||||
| 207 | |||||
| 208 | if (@_ == 1) { | ||||
| 209 | my %props; | ||||
| 210 | for $name (@Properties) { | ||||
| 211 | my $method = 'get_' . $name; | ||||
| 212 | if ($name eq 'max_size') { | ||||
| 213 | my $value = $self->$method(); | ||||
| 214 | $props{$name} = $value == 1 ? 0 : $value; | ||||
| 215 | next; | ||||
| 216 | } | ||||
| 217 | $props{$name} = $self->$method(); | ||||
| 218 | } | ||||
| 219 | return \%props; | ||||
| 220 | } | ||||
| 221 | elsif (@_ > 3) { | ||||
| 222 | Carp::croak('property() can take only the option within 2 arguments.'); | ||||
| 223 | } | ||||
| 224 | elsif (@_ == 2) { | ||||
| 225 | if ( my $method = $self->can('get_' . $name) ) { | ||||
| 226 | if ($name eq 'max_size') { | ||||
| 227 | my $value = $self->$method(); | ||||
| 228 | return $value == 1 ? 0 : $value; | ||||
| 229 | } | ||||
| 230 | $self->$method(); | ||||
| 231 | } | ||||
| 232 | } | ||||
| 233 | else { | ||||
| 234 | $self->$name($value); | ||||
| 235 | } | ||||
| 236 | |||||
| 237 | } | ||||
| 238 | |||||
| - - | |||||
| 241 | # INTERNAL | ||||
| 242 | |||||
| 243 | # spent 87.0ms (8.88+78.1) within JSON::_load_xs which was called:
# once (8.88ms+78.1ms) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 58 | ||||
| 244 | 1 | 2µs | my $opt = shift; | ||
| 245 | |||||
| 246 | 1 | 700ns | $JSON::DEBUG and Carp::carp "Load $Module_XS."; | ||
| 247 | |||||
| 248 | # if called after install module, overload is disable.... why? | ||||
| 249 | 1 | 8µs | 1 | 11.2ms | JSON::Boolean::_overrride_overload($Module_XS); # spent 11.2ms making 1 call to JSON::Boolean::_overrride_overload |
| 250 | 1 | 11µs | 1 | 1.06ms | JSON::Boolean::_overrride_overload($Module_PP); # spent 1.06ms making 1 call to JSON::Boolean::_overrride_overload |
| 251 | |||||
| 252 | 1 | 172µs | eval qq| # spent 848µs executing statements in string eval # includes 5.67ms spent executing 1 call to 1 sub defined therein. | ||
| 253 | use $Module_XS $XS_Version (); | ||||
| 254 | |; | ||||
| 255 | |||||
| 256 | 1 | 1µs | if ($@) { | ||
| 257 | if (defined $opt and $opt & $_INSTALL_DONT_DIE) { | ||||
| 258 | $JSON::DEBUG and Carp::carp "Can't load $Module_XS...($@)"; | ||||
| 259 | return 0; | ||||
| 260 | } | ||||
| 261 | Carp::croak $@; | ||||
| 262 | } | ||||
| 263 | |||||
| 264 | 1 | 6µs | unless (defined $opt and $opt & $_INSTALL_ONLY) { | ||
| 265 | 1 | 13µs | 1 | 448µs | _set_module( $JSON::Backend = $Module_XS ); # spent 448µs making 1 call to JSON::_set_module |
| 266 | 1 | 3.62ms | 1 | 2.61ms | my $data = join("", <DATA>); # this code is from Jcode 2.xx. # spent 2.61ms making 1 call to JSON::CORE:readline |
| 267 | 1 | 125µs | 1 | 66µs | close(DATA); # spent 66µs making 1 call to JSON::CORE:close |
| 268 | 1 | 1.72ms | eval $data; # spent 6.18ms executing statements in string eval # includes 519µs spent executing 7 calls to 21 subs defined therein. | ||
| 269 | 1 | 28µs | 1 | 135µs | JSON::Backend::XS->init; # spent 135µs making 1 call to JSON::Backend::XS::init |
| 270 | } | ||||
| 271 | |||||
| 272 | 1 | 24µs | return 1; | ||
| 273 | }; | ||||
| 274 | |||||
| 275 | |||||
| 276 | sub _load_pp { | ||||
| 277 | my $opt = shift; | ||||
| 278 | my $backend = $_USSING_bpPP ? $Module_bp : $Module_PP; | ||||
| 279 | |||||
| 280 | $JSON::DEBUG and Carp::carp "Load $backend."; | ||||
| 281 | |||||
| 282 | # if called after install module, overload is disable.... why? | ||||
| 283 | JSON::Boolean::_overrride_overload($Module_XS); | ||||
| 284 | JSON::Boolean::_overrride_overload($backend); | ||||
| 285 | |||||
| 286 | if ( $_USSING_bpPP ) { | ||||
| 287 | eval qq| require $backend |; | ||||
| 288 | } | ||||
| 289 | else { | ||||
| 290 | eval qq| use $backend $PP_Version () |; | ||||
| 291 | } | ||||
| 292 | |||||
| 293 | if ($@) { | ||||
| 294 | if ( $backend eq $Module_PP ) { | ||||
| 295 | $JSON::DEBUG and Carp::carp "Can't load $Module_PP ($@), so try to load $Module_bp"; | ||||
| 296 | $_USSING_bpPP++; | ||||
| 297 | $backend = $Module_bp; | ||||
| 298 | JSON::Boolean::_overrride_overload($backend); | ||||
| 299 | local $^W; # if PP installed but invalid version, backportPP redifines methods. | ||||
| 300 | eval qq| require $Module_bp |; | ||||
| 301 | } | ||||
| 302 | Carp::croak $@ if $@; | ||||
| 303 | } | ||||
| 304 | |||||
| 305 | unless (defined $opt and $opt & $_INSTALL_ONLY) { | ||||
| 306 | _set_module( $JSON::Backend = $Module_PP ); # even if backportPP, set $Backend with 'JSON::PP' | ||||
| 307 | JSON::Backend::PP->init; | ||||
| 308 | } | ||||
| 309 | }; | ||||
| 310 | |||||
| 311 | |||||
| 312 | # spent 448µs within JSON::_set_module which was called:
# once (448µs+0s) by JSON::_load_xs at line 265 | ||||
| 313 | 1 | 2µs | return if defined $JSON::true; | ||
| 314 | |||||
| 315 | 1 | 4µs | my $module = shift; | ||
| 316 | |||||
| 317 | 1 | 56µs | local $^W; | ||
| 318 | 2 | 1.52ms | 2 | 255µs | # spent 164µs (74+90) within JSON::BEGIN@318 which was called:
# once (74µs+90µs) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 318 # spent 164µs making 1 call to JSON::BEGIN@318
# spent 90µs making 1 call to strict::unimport |
| 319 | |||||
| 320 | 1 | 17µs | $JSON::true = ${"$module\::true"}; | ||
| 321 | 1 | 10µs | $JSON::false = ${"$module\::false"}; | ||
| 322 | |||||
| 323 | 1 | 50µs | push @JSON::ISA, $module; | ||
| 324 | 1 | 56µs | push @{"$module\::Boolean::ISA"}, qw(JSON::Boolean); | ||
| 325 | |||||
| 326 | 1 | 21µs | *{"JSON::is_bool"} = \&{"$module\::is_bool"}; | ||
| 327 | |||||
| 328 | 1 | 11µs | for my $method ($module eq $Module_XS ? @PPOnlyMethods : @XSOnlyMethods) { | ||
| 329 | *{"JSON::$method"} = sub { | ||||
| 330 | Carp::carp("$method is not supported in $module."); | ||||
| 331 | $_[0]; | ||||
| 332 | 8 | 208µs | }; | ||
| 333 | } | ||||
| 334 | |||||
| 335 | 1 | 33µs | return 1; | ||
| 336 | } | ||||
| 337 | |||||
| - - | |||||
| 340 | # | ||||
| 341 | # JSON Boolean | ||||
| 342 | # | ||||
| 343 | |||||
| 344 | package JSON::Boolean; | ||||
| 345 | |||||
| 346 | 1 | 1µs | my %Installed; | ||
| 347 | |||||
| 348 | sub _overrride_overload { | ||||
| 349 | 2 | 16µs | return if ($Installed{ $_[0] }++); | ||
| 350 | |||||
| 351 | 2 | 8µs | my $boolean = $_[0] . '::Boolean'; | ||
| 352 | |||||
| 353 | 2 | 1.48ms | eval sprintf(q| # spent 3.11ms executing statements in string eval # includes 6.88ms spent executing 1 call to 3 subs defined therein. # spent 91µs executing statements in string eval # includes 85µs spent executing 1 call to 3 subs defined therein. | ||
| 354 | package %s; | ||||
| 355 | use overload ( | ||||
| 356 | '""' => sub { ${$_[0]} == 1 ? 'true' : 'false' }, | ||||
| 357 | 'eq' => sub { | ||||
| 358 | my ($obj, $op) = ref ($_[0]) ? ($_[0], $_[1]) : ($_[1], $_[0]); | ||||
| 359 | if ($op eq 'true' or $op eq 'false') { | ||||
| 360 | return "$obj" eq 'true' ? 'true' eq $op : 'false' eq $op; | ||||
| 361 | } | ||||
| 362 | else { | ||||
| 363 | return $obj ? 1 == $op : 0 == $op; | ||||
| 364 | } | ||||
| 365 | }, | ||||
| 366 | ); | ||||
| 367 | |, $boolean); | ||||
| 368 | |||||
| 369 | 2 | 2µs | if ($@) { Carp::croak $@; } | ||
| 370 | |||||
| 371 | 2 | 45µs | return 1; | ||
| 372 | } | ||||
| 373 | |||||
| 374 | |||||
| 375 | # | ||||
| 376 | # Helper classes for Backend Module (PP) | ||||
| 377 | # | ||||
| 378 | |||||
| 379 | package JSON::Backend::PP; | ||||
| 380 | |||||
| 381 | sub init { | ||||
| 382 | local $^W; | ||||
| 383 | 2 | 613µs | 2 | 231µs | # spent 146µs (62+85) within JSON::Backend::PP::BEGIN@383 which was called:
# once (62µs+85µs) by RTP::Webmerge::Embedder::JS::BEGIN@20 at line 383 # spent 146µs making 1 call to JSON::Backend::PP::BEGIN@383
# spent 85µs making 1 call to strict::unimport |
| 384 | *{"JSON::decode_json"} = \&{"JSON::PP::decode_json"}; | ||||
| 385 | *{"JSON::encode_json"} = \&{"JSON::PP::encode_json"}; | ||||
| 386 | *{"JSON::PP::is_xs"} = sub { 0 }; | ||||
| 387 | *{"JSON::PP::is_pp"} = sub { 1 }; | ||||
| 388 | return 1; | ||||
| 389 | } | ||||
| 390 | |||||
| 391 | # | ||||
| 392 | # To save memory, the below lines are read only when XS backend is used. | ||||
| 393 | # | ||||
| 394 | |||||
| 395 | package JSON; | ||||
| 396 | |||||
| 397 | 1 | 102µs | 1; | ||
| 398 | __DATA__ | ||||
# spent 66µs within JSON::CORE:close which was called:
# once (66µs+0s) by JSON::_load_xs at line 267 | |||||
# spent 2.61ms within JSON::CORE:readline which was called:
# once (2.61ms+0s) by JSON::_load_xs at line 266 |