mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-25 01:55:39 +01:00
perl: ord(substr(...)) *is* faster than unpack()
This commit is contained in:
parent
6a9cb51828
commit
5de2b974fb
@ -304,12 +304,12 @@ foreach my $pair(
|
||||
|
||||
sub _unpack {
|
||||
my ( $value ) = @_;
|
||||
# get a header byte
|
||||
defined(my $byte = unpack "x$p C", $value)
|
||||
$p < length($value)
|
||||
or Carp::confess("Data::MessagePack->unpack: insufficient bytes");
|
||||
# get a header byte
|
||||
my $byte = ord( substr $value, $p, 1 );
|
||||
$p++;
|
||||
|
||||
|
||||
# +/- fixnum, nil, true, false
|
||||
return $byte2value[$byte] if $typemap[$byte] & $T_DIRECT;
|
||||
|
||||
@ -454,6 +454,9 @@ sub execute {
|
||||
$self->{buff} .= $value;
|
||||
local $self->{stack} = [];
|
||||
|
||||
#$p = 0;
|
||||
#eval { Data::MessagePack::PP::_unpack($self->{buff}) };
|
||||
#warn "[$p][$@]";
|
||||
$p = 0;
|
||||
|
||||
while ( length($self->{buff}) > $p ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user