Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
this optimization does not work on Perl 5.10 and 5.12
  • Loading branch information
kraih committed Dec 5, 2015
1 parent 6a3268c commit bc13366
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion Changes
@@ -1,6 +1,5 @@

6.36 2015-12-06
- Improved Mojo::JSON performance slightly. (haarg)

6.35 2015-12-04
- Removed deprecated collecting method from Mojo::UserAgent::CookieJar.
Expand Down
7 changes: 3 additions & 4 deletions lib/Mojo/JSON.pm
@@ -1,6 +1,7 @@
package Mojo::JSON;
use Mojo::Base -strict;

use B;
use Carp 'croak';
use Exporter 'import';
use JSON::PP ();
Expand Down Expand Up @@ -248,11 +249,9 @@ sub _encode_value {
# Null
return 'null' unless defined $value;

# Number (bitwise operators change behavior based on the internal value type)
my $check = "0" & $value;
# Number
return $value
if !($check ^ $check)
&& length $check
if B::svref_2object(\$value)->FLAGS & (B::SVp_IOK | B::SVp_NOK)
&& 0 + $value eq $value
&& $value * 0 == 0;

Expand Down

0 comments on commit bc13366

Please sign in to comment.